proteus  1.8.0
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.29.24 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8  #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10  #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_24"
13 #define CYTHON_HEX_VERSION 0x001D18F0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20  #ifndef __stdcall
21  #define __stdcall
22  #endif
23  #ifndef __cdecl
24  #define __cdecl
25  #endif
26  #ifndef __fastcall
27  #define __fastcall
28  #endif
29 #endif
30 #ifndef DL_IMPORT
31  #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34  #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38  #if PY_VERSION_HEX >= 0x02070000
39  #define HAVE_LONG_LONG
40  #endif
41 #endif
42 #ifndef PY_LONG_LONG
43  #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46  #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49  #define CYTHON_COMPILING_IN_PYPY 1
50  #define CYTHON_COMPILING_IN_PYSTON 0
51  #define CYTHON_COMPILING_IN_CPYTHON 0
52  #undef CYTHON_USE_TYPE_SLOTS
53  #define CYTHON_USE_TYPE_SLOTS 0
54  #undef CYTHON_USE_PYTYPE_LOOKUP
55  #define CYTHON_USE_PYTYPE_LOOKUP 0
56  #if PY_VERSION_HEX < 0x03050000
57  #undef CYTHON_USE_ASYNC_SLOTS
58  #define CYTHON_USE_ASYNC_SLOTS 0
59  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60  #define CYTHON_USE_ASYNC_SLOTS 1
61  #endif
62  #undef CYTHON_USE_PYLIST_INTERNALS
63  #define CYTHON_USE_PYLIST_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_INTERNALS
65  #define CYTHON_USE_UNICODE_INTERNALS 0
66  #undef CYTHON_USE_UNICODE_WRITER
67  #define CYTHON_USE_UNICODE_WRITER 0
68  #undef CYTHON_USE_PYLONG_INTERNALS
69  #define CYTHON_USE_PYLONG_INTERNALS 0
70  #undef CYTHON_AVOID_BORROWED_REFS
71  #define CYTHON_AVOID_BORROWED_REFS 1
72  #undef CYTHON_ASSUME_SAFE_MACROS
73  #define CYTHON_ASSUME_SAFE_MACROS 0
74  #undef CYTHON_UNPACK_METHODS
75  #define CYTHON_UNPACK_METHODS 0
76  #undef CYTHON_FAST_THREAD_STATE
77  #define CYTHON_FAST_THREAD_STATE 0
78  #undef CYTHON_FAST_PYCALL
79  #define CYTHON_FAST_PYCALL 0
80  #undef CYTHON_PEP489_MULTI_PHASE_INIT
81  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82  #undef CYTHON_USE_TP_FINALIZE
83  #define CYTHON_USE_TP_FINALIZE 0
84  #undef CYTHON_USE_DICT_VERSIONS
85  #define CYTHON_USE_DICT_VERSIONS 0
86  #undef CYTHON_USE_EXC_INFO_STACK
87  #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89  #define CYTHON_COMPILING_IN_PYPY 0
90  #define CYTHON_COMPILING_IN_PYSTON 1
91  #define CYTHON_COMPILING_IN_CPYTHON 0
92  #ifndef CYTHON_USE_TYPE_SLOTS
93  #define CYTHON_USE_TYPE_SLOTS 1
94  #endif
95  #undef CYTHON_USE_PYTYPE_LOOKUP
96  #define CYTHON_USE_PYTYPE_LOOKUP 0
97  #undef CYTHON_USE_ASYNC_SLOTS
98  #define CYTHON_USE_ASYNC_SLOTS 0
99  #undef CYTHON_USE_PYLIST_INTERNALS
100  #define CYTHON_USE_PYLIST_INTERNALS 0
101  #ifndef CYTHON_USE_UNICODE_INTERNALS
102  #define CYTHON_USE_UNICODE_INTERNALS 1
103  #endif
104  #undef CYTHON_USE_UNICODE_WRITER
105  #define CYTHON_USE_UNICODE_WRITER 0
106  #undef CYTHON_USE_PYLONG_INTERNALS
107  #define CYTHON_USE_PYLONG_INTERNALS 0
108  #ifndef CYTHON_AVOID_BORROWED_REFS
109  #define CYTHON_AVOID_BORROWED_REFS 0
110  #endif
111  #ifndef CYTHON_ASSUME_SAFE_MACROS
112  #define CYTHON_ASSUME_SAFE_MACROS 1
113  #endif
114  #ifndef CYTHON_UNPACK_METHODS
115  #define CYTHON_UNPACK_METHODS 1
116  #endif
117  #undef CYTHON_FAST_THREAD_STATE
118  #define CYTHON_FAST_THREAD_STATE 0
119  #undef CYTHON_FAST_PYCALL
120  #define CYTHON_FAST_PYCALL 0
121  #undef CYTHON_PEP489_MULTI_PHASE_INIT
122  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123  #undef CYTHON_USE_TP_FINALIZE
124  #define CYTHON_USE_TP_FINALIZE 0
125  #undef CYTHON_USE_DICT_VERSIONS
126  #define CYTHON_USE_DICT_VERSIONS 0
127  #undef CYTHON_USE_EXC_INFO_STACK
128  #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130  #define CYTHON_COMPILING_IN_PYPY 0
131  #define CYTHON_COMPILING_IN_PYSTON 0
132  #define CYTHON_COMPILING_IN_CPYTHON 1
133  #ifndef CYTHON_USE_TYPE_SLOTS
134  #define CYTHON_USE_TYPE_SLOTS 1
135  #endif
136  #if PY_VERSION_HEX < 0x02070000
137  #undef CYTHON_USE_PYTYPE_LOOKUP
138  #define CYTHON_USE_PYTYPE_LOOKUP 0
139  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140  #define CYTHON_USE_PYTYPE_LOOKUP 1
141  #endif
142  #if PY_MAJOR_VERSION < 3
143  #undef CYTHON_USE_ASYNC_SLOTS
144  #define CYTHON_USE_ASYNC_SLOTS 0
145  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146  #define CYTHON_USE_ASYNC_SLOTS 1
147  #endif
148  #if PY_VERSION_HEX < 0x02070000
149  #undef CYTHON_USE_PYLONG_INTERNALS
150  #define CYTHON_USE_PYLONG_INTERNALS 0
151  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152  #define CYTHON_USE_PYLONG_INTERNALS 1
153  #endif
154  #ifndef CYTHON_USE_PYLIST_INTERNALS
155  #define CYTHON_USE_PYLIST_INTERNALS 1
156  #endif
157  #ifndef CYTHON_USE_UNICODE_INTERNALS
158  #define CYTHON_USE_UNICODE_INTERNALS 1
159  #endif
160  #if PY_VERSION_HEX < 0x030300F0
161  #undef CYTHON_USE_UNICODE_WRITER
162  #define CYTHON_USE_UNICODE_WRITER 0
163  #elif !defined(CYTHON_USE_UNICODE_WRITER)
164  #define CYTHON_USE_UNICODE_WRITER 1
165  #endif
166  #ifndef CYTHON_AVOID_BORROWED_REFS
167  #define CYTHON_AVOID_BORROWED_REFS 0
168  #endif
169  #ifndef CYTHON_ASSUME_SAFE_MACROS
170  #define CYTHON_ASSUME_SAFE_MACROS 1
171  #endif
172  #ifndef CYTHON_UNPACK_METHODS
173  #define CYTHON_UNPACK_METHODS 1
174  #endif
175  #ifndef CYTHON_FAST_THREAD_STATE
176  #define CYTHON_FAST_THREAD_STATE 1
177  #endif
178  #ifndef CYTHON_FAST_PYCALL
179  #define CYTHON_FAST_PYCALL 1
180  #endif
181  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183  #endif
184  #ifndef CYTHON_USE_TP_FINALIZE
185  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186  #endif
187  #ifndef CYTHON_USE_DICT_VERSIONS
188  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189  #endif
190  #ifndef CYTHON_USE_EXC_INFO_STACK
191  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192  #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198  #include "longintrepr.h"
199  #undef SHIFT
200  #undef BASE
201  #undef MASK
202  #ifdef SIZEOF_VOID_P
203  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
204  #endif
205 #endif
206 #ifndef __has_attribute
207  #define __has_attribute(x) 0
208 #endif
209 #ifndef __has_cpp_attribute
210  #define __has_cpp_attribute(x) 0
211 #endif
212 #ifndef CYTHON_RESTRICT
213  #if defined(__GNUC__)
214  #define CYTHON_RESTRICT __restrict__
215  #elif defined(_MSC_VER) && _MSC_VER >= 1400
216  #define CYTHON_RESTRICT __restrict
217  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218  #define CYTHON_RESTRICT restrict
219  #else
220  #define CYTHON_RESTRICT
221  #endif
222 #endif
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 # define CYTHON_UNUSED __attribute__ ((__unused__))
227 # else
228 # define CYTHON_UNUSED
229 # endif
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 # define CYTHON_UNUSED __attribute__ ((__unused__))
232 # else
233 # define CYTHON_UNUSED
234 # endif
235 #endif
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 # if defined(__cplusplus)
238  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
239 # else
240 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 # endif
242 #endif
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 # define CYTHON_NCP_UNUSED
246 # else
247 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 # endif
249 #endif
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
251 #ifdef _MSC_VER
252  #ifndef _MSC_STDINT_H_
253  #if _MSC_VER < 1300
254  typedef unsigned char uint8_t;
255  typedef unsigned int uint32_t;
256  #else
257  typedef unsigned __int8 uint8_t;
258  typedef unsigned __int32 uint32_t;
259  #endif
260  #endif
261 #else
262  #include <stdint.h>
263 #endif
264 #ifndef CYTHON_FALLTHROUGH
265  #if defined(__cplusplus) && __cplusplus >= 201103L
266  #if __has_cpp_attribute(fallthrough)
267  #define CYTHON_FALLTHROUGH [[fallthrough]]
268  #elif __has_cpp_attribute(clang::fallthrough)
269  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270  #elif __has_cpp_attribute(gnu::fallthrough)
271  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272  #endif
273  #endif
274  #ifndef CYTHON_FALLTHROUGH
275  #if __has_attribute(fallthrough)
276  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
277  #else
278  #define CYTHON_FALLTHROUGH
279  #endif
280  #endif
281  #if defined(__clang__ ) && defined(__apple_build_version__)
282  #if __apple_build_version__ < 7000000
283  #undef CYTHON_FALLTHROUGH
284  #define CYTHON_FALLTHROUGH
285  #endif
286  #endif
287 #endif
288 
289 #ifndef CYTHON_INLINE
290  #if defined(__clang__)
291  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
292  #elif defined(__GNUC__)
293  #define CYTHON_INLINE __inline__
294  #elif defined(_MSC_VER)
295  #define CYTHON_INLINE __inline
296  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
297  #define CYTHON_INLINE inline
298  #else
299  #define CYTHON_INLINE
300  #endif
301 #endif
302 
303 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
304  #define Py_OptimizeFlag 0
305 #endif
306 #define __PYX_BUILD_PY_SSIZE_T "n"
307 #define CYTHON_FORMAT_SSIZE_T "z"
308 #if PY_MAJOR_VERSION < 3
309  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
310  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
311  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
312  #define __Pyx_DefaultClassType PyClass_Type
313 #else
314  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
315 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
316  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
317  PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
318 #else
319  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
320  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
321 #endif
322  #define __Pyx_DefaultClassType PyType_Type
323 #endif
324 #ifndef Py_TPFLAGS_CHECKTYPES
325  #define Py_TPFLAGS_CHECKTYPES 0
326 #endif
327 #ifndef Py_TPFLAGS_HAVE_INDEX
328  #define Py_TPFLAGS_HAVE_INDEX 0
329 #endif
330 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
331  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
332 #endif
333 #ifndef Py_TPFLAGS_HAVE_FINALIZE
334  #define Py_TPFLAGS_HAVE_FINALIZE 0
335 #endif
336 #ifndef METH_STACKLESS
337  #define METH_STACKLESS 0
338 #endif
339 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
340  #ifndef METH_FASTCALL
341  #define METH_FASTCALL 0x80
342  #endif
343  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
344  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
345  Py_ssize_t nargs, PyObject *kwnames);
346 #else
347  #define __Pyx_PyCFunctionFast _PyCFunctionFast
348  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
349 #endif
350 #if CYTHON_FAST_PYCCALL
351 #define __Pyx_PyFastCFunction_Check(func)\
352  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
353 #else
354 #define __Pyx_PyFastCFunction_Check(func) 0
355 #endif
356 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
357  #define PyObject_Malloc(s) PyMem_Malloc(s)
358  #define PyObject_Free(p) PyMem_Free(p)
359  #define PyObject_Realloc(p) PyMem_Realloc(p)
360 #endif
361 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
362  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
363  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
364  #define PyMem_RawFree(p) PyMem_Free(p)
365 #endif
366 #if CYTHON_COMPILING_IN_PYSTON
367  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
368  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
369 #else
370  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
371  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
372 #endif
373 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
374  #define __Pyx_PyThreadState_Current PyThreadState_GET()
375 #elif PY_VERSION_HEX >= 0x03060000
376  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
377 #elif PY_VERSION_HEX >= 0x03000000
378  #define __Pyx_PyThreadState_Current PyThreadState_GET()
379 #else
380  #define __Pyx_PyThreadState_Current _PyThreadState_Current
381 #endif
382 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
383 #include "pythread.h"
384 #define Py_tss_NEEDS_INIT 0
385 typedef int Py_tss_t;
386 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
387  *key = PyThread_create_key();
388  return 0;
389 }
390 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
391  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
392  *key = Py_tss_NEEDS_INIT;
393  return key;
394 }
395 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
396  PyObject_Free(key);
397 }
398 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
399  return *key != Py_tss_NEEDS_INIT;
400 }
401 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
402  PyThread_delete_key(*key);
403  *key = Py_tss_NEEDS_INIT;
404 }
405 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
406  return PyThread_set_key_value(*key, value);
407 }
408 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
409  return PyThread_get_key_value(*key);
410 }
411 #endif
412 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
413 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
414 #else
415 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
416 #endif
417 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
418  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
419  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
420 #else
421  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
422  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
423 #endif
424 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
425 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
426 #else
427 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
428 #endif
429 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
430  #define CYTHON_PEP393_ENABLED 1
431  #if defined(PyUnicode_IS_READY)
432  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
433  0 : _PyUnicode_Ready((PyObject *)(op)))
434  #else
435  #define __Pyx_PyUnicode_READY(op) (0)
436  #endif
437  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
438  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
439  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
440  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
441  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
442  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
443  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
444  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
445  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
446  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
447  #else
448  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
449  #endif
450  #else
451  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
452  #endif
453 #else
454  #define CYTHON_PEP393_ENABLED 0
455  #define PyUnicode_1BYTE_KIND 1
456  #define PyUnicode_2BYTE_KIND 2
457  #define PyUnicode_4BYTE_KIND 4
458  #define __Pyx_PyUnicode_READY(op) (0)
459  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY
469  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
471 #else
472  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
475 #endif
476 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
478 #endif
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
484 #endif
485 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
486 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487 #if PY_MAJOR_VERSION >= 3
488  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
489 #else
490  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
491 #endif
492 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493  #define PyObject_ASCII(o) PyObject_Repr(o)
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496  #define PyBaseString_Type PyUnicode_Type
497  #define PyStringObject PyUnicodeObject
498  #define PyString_Type PyUnicode_Type
499  #define PyString_Check PyUnicode_Check
500  #define PyString_CheckExact PyUnicode_CheckExact
501 #ifndef PyObject_Unicode
502  #define PyObject_Unicode PyObject_Str
503 #endif
504 #endif
505 #if PY_MAJOR_VERSION >= 3
506  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
508 #else
509  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
511 #endif
512 #ifndef PySet_CheckExact
513  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
514 #endif
515 #if PY_VERSION_HEX >= 0x030900A4
516  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
517  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
518 #else
519  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
520  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
521 #endif
522 #if CYTHON_ASSUME_SAFE_MACROS
523  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
524 #else
525  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
526 #endif
527 #if PY_MAJOR_VERSION >= 3
528  #define PyIntObject PyLongObject
529  #define PyInt_Type PyLong_Type
530  #define PyInt_Check(op) PyLong_Check(op)
531  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
532  #define PyInt_FromString PyLong_FromString
533  #define PyInt_FromUnicode PyLong_FromUnicode
534  #define PyInt_FromLong PyLong_FromLong
535  #define PyInt_FromSize_t PyLong_FromSize_t
536  #define PyInt_FromSsize_t PyLong_FromSsize_t
537  #define PyInt_AsLong PyLong_AsLong
538  #define PyInt_AS_LONG PyLong_AS_LONG
539  #define PyInt_AsSsize_t PyLong_AsSsize_t
540  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
541  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
542  #define PyNumber_Int PyNumber_Long
543 #endif
544 #if PY_MAJOR_VERSION >= 3
545  #define PyBoolObject PyLongObject
546 #endif
547 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
548  #ifndef PyUnicode_InternFromString
549  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
550  #endif
551 #endif
552 #if PY_VERSION_HEX < 0x030200A4
553  typedef long Py_hash_t;
554  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
555  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
556 #else
557  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
558  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
559 #endif
560 #if PY_MAJOR_VERSION >= 3
561  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
562 #else
563  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
564 #endif
565 #if CYTHON_USE_ASYNC_SLOTS
566  #if PY_VERSION_HEX >= 0x030500B1
567  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
568  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
569  #else
570  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
571  #endif
572 #else
573  #define __Pyx_PyType_AsAsync(obj) NULL
574 #endif
575 #ifndef __Pyx_PyAsyncMethodsStruct
576  typedef struct {
577  unaryfunc am_await;
578  unaryfunc am_aiter;
579  unaryfunc am_anext;
580  } __Pyx_PyAsyncMethodsStruct;
581 #endif
582 
583 #if defined(WIN32) || defined(MS_WINDOWS)
584  #define _USE_MATH_DEFINES
585 #endif
586 #include <math.h>
587 #ifdef NAN
588 #define __PYX_NAN() ((float) NAN)
589 #else
590 static CYTHON_INLINE float __PYX_NAN() {
591  float value;
592  memset(&value, 0xFF, sizeof(value));
593  return value;
594 }
595 #endif
596 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
597 #define __Pyx_truncl trunc
598 #else
599 #define __Pyx_truncl truncl
600 #endif
601 
602 #define __PYX_MARK_ERR_POS(f_index, lineno) \
603  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
604 #define __PYX_ERR(f_index, lineno, Ln_error) \
605  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
606 
607 #ifndef __PYX_EXTERN_C
608  #ifdef __cplusplus
609  #define __PYX_EXTERN_C extern "C"
610  #else
611  #define __PYX_EXTERN_C extern
612  #endif
613 #endif
614 
615 #define __PYX_HAVE__subsurfaceTransportFunctions
616 #define __PYX_HAVE_API__subsurfaceTransportFunctions
617 /* Early includes */
618 #include <string.h>
619 #include <stdio.h>
620 #include "numpy/arrayobject.h"
621 #include "numpy/ndarrayobject.h"
622 #include "numpy/ndarraytypes.h"
623 #include "numpy/arrayscalars.h"
624 #include "numpy/ufuncobject.h"
625 
626  /* NumPy API declarations from "numpy/__init__.pxd" */
627 
628 #include "math.h"
629 #ifdef _OPENMP
630 #include <omp.h>
631 #endif /* _OPENMP */
632 
633 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
634 #define CYTHON_WITHOUT_ASSERTIONS
635 #endif
636 
637 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
638  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
639 
640 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
641 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
642 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
643 #define __PYX_DEFAULT_STRING_ENCODING ""
644 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
645 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
646 #define __Pyx_uchar_cast(c) ((unsigned char)c)
647 #define __Pyx_long_cast(x) ((long)x)
648 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
649  (sizeof(type) < sizeof(Py_ssize_t)) ||\
650  (sizeof(type) > sizeof(Py_ssize_t) &&\
651  likely(v < (type)PY_SSIZE_T_MAX ||\
652  v == (type)PY_SSIZE_T_MAX) &&\
653  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
654  v == (type)PY_SSIZE_T_MIN))) ||\
655  (sizeof(type) == sizeof(Py_ssize_t) &&\
656  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
657  v == (type)PY_SSIZE_T_MAX))) )
658 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
659  return (size_t) i < (size_t) limit;
660 }
661 #if defined (__cplusplus) && __cplusplus >= 201103L
662  #include <cstdlib>
663  #define __Pyx_sst_abs(value) std::abs(value)
664 #elif SIZEOF_INT >= SIZEOF_SIZE_T
665  #define __Pyx_sst_abs(value) abs(value)
666 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
667  #define __Pyx_sst_abs(value) labs(value)
668 #elif defined (_MSC_VER)
669  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
670 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
671  #define __Pyx_sst_abs(value) llabs(value)
672 #elif defined (__GNUC__)
673  #define __Pyx_sst_abs(value) __builtin_llabs(value)
674 #else
675  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
676 #endif
677 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
678 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
679 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
680 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
681 #define __Pyx_PyBytes_FromString PyBytes_FromString
682 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
683 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
684 #if PY_MAJOR_VERSION < 3
685  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
686  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
687 #else
688  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
689  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
690 #endif
691 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
692 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
693 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
694 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
695 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
696 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
697 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
698 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
699 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
700 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
701 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
702 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
703 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
704 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
705 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
706 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
707 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
708  const Py_UNICODE *u_end = u;
709  while (*u_end++) ;
710  return (size_t)(u_end - u - 1);
711 }
712 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
713 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
714 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
715 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
716 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
717 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
718 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
719 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
720 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
721 #define __Pyx_PySequence_Tuple(obj)\
722  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
723 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
724 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
725 #if CYTHON_ASSUME_SAFE_MACROS
726 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
727 #else
728 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
729 #endif
730 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
731 #if PY_MAJOR_VERSION >= 3
732 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
733 #else
734 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
735 #endif
736 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
737 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
738 static int __Pyx_sys_getdefaultencoding_not_ascii;
739 static int __Pyx_init_sys_getdefaultencoding_params(void) {
740  PyObject* sys;
741  PyObject* default_encoding = NULL;
742  PyObject* ascii_chars_u = NULL;
743  PyObject* ascii_chars_b = NULL;
744  const char* default_encoding_c;
745  sys = PyImport_ImportModule("sys");
746  if (!sys) goto bad;
747  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
748  Py_DECREF(sys);
749  if (!default_encoding) goto bad;
750  default_encoding_c = PyBytes_AsString(default_encoding);
751  if (!default_encoding_c) goto bad;
752  if (strcmp(default_encoding_c, "ascii") == 0) {
753  __Pyx_sys_getdefaultencoding_not_ascii = 0;
754  } else {
755  char ascii_chars[128];
756  int c;
757  for (c = 0; c < 128; c++) {
758  ascii_chars[c] = c;
759  }
760  __Pyx_sys_getdefaultencoding_not_ascii = 1;
761  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
762  if (!ascii_chars_u) goto bad;
763  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
764  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
765  PyErr_Format(
766  PyExc_ValueError,
767  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
768  default_encoding_c);
769  goto bad;
770  }
771  Py_DECREF(ascii_chars_u);
772  Py_DECREF(ascii_chars_b);
773  }
774  Py_DECREF(default_encoding);
775  return 0;
776 bad:
777  Py_XDECREF(default_encoding);
778  Py_XDECREF(ascii_chars_u);
779  Py_XDECREF(ascii_chars_b);
780  return -1;
781 }
782 #endif
783 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
784 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
785 #else
786 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
787 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
788 static char* __PYX_DEFAULT_STRING_ENCODING;
789 static int __Pyx_init_sys_getdefaultencoding_params(void) {
790  PyObject* sys;
791  PyObject* default_encoding = NULL;
792  char* default_encoding_c;
793  sys = PyImport_ImportModule("sys");
794  if (!sys) goto bad;
795  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
796  Py_DECREF(sys);
797  if (!default_encoding) goto bad;
798  default_encoding_c = PyBytes_AsString(default_encoding);
799  if (!default_encoding_c) goto bad;
800  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
801  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
802  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
803  Py_DECREF(default_encoding);
804  return 0;
805 bad:
806  Py_XDECREF(default_encoding);
807  return -1;
808 }
809 #endif
810 #endif
811 
812 
813 /* Test for GCC > 2.95 */
814 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
815  #define likely(x) __builtin_expect(!!(x), 1)
816  #define unlikely(x) __builtin_expect(!!(x), 0)
817 #else /* !__GNUC__ or GCC < 2.95 */
818  #define likely(x) (x)
819  #define unlikely(x) (x)
820 #endif /* __GNUC__ */
821 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
822 
823 static PyObject *__pyx_m = NULL;
824 static PyObject *__pyx_d;
825 static PyObject *__pyx_b;
826 static PyObject *__pyx_cython_runtime = NULL;
827 static PyObject *__pyx_empty_tuple;
828 static PyObject *__pyx_empty_bytes;
829 static PyObject *__pyx_empty_unicode;
830 static int __pyx_lineno;
831 static int __pyx_clineno = 0;
832 static const char * __pyx_cfilenm= __FILE__;
833 static const char *__pyx_filename;
834 
835 /* Header.proto */
836 #if !defined(CYTHON_CCOMPLEX)
837  #if defined(__cplusplus)
838  #define CYTHON_CCOMPLEX 1
839  #elif defined(_Complex_I)
840  #define CYTHON_CCOMPLEX 1
841  #else
842  #define CYTHON_CCOMPLEX 0
843  #endif
844 #endif
845 #if CYTHON_CCOMPLEX
846  #ifdef __cplusplus
847  #include <complex>
848  #else
849  #include <complex.h>
850  #endif
851 #endif
852 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
853  #undef _Complex_I
854  #define _Complex_I 1.0fj
855 #endif
856 
857 
858 static const char *__pyx_f[] = {
859  "proteus/subsurfaceTransportFunctions.pyx",
860  "__init__.pxd",
861  "type.pxd",
862 };
863 /* BufferFormatStructs.proto */
864 #define IS_UNSIGNED(type) (((type) -1) > 0)
865 struct __Pyx_StructField_;
866 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
867 typedef struct {
868  const char* name;
869  struct __Pyx_StructField_* fields;
870  size_t size;
871  size_t arraysize[8];
872  int ndim;
873  char typegroup;
874  char is_unsigned;
875  int flags;
876 } __Pyx_TypeInfo;
877 typedef struct __Pyx_StructField_ {
878  __Pyx_TypeInfo* type;
879  const char* name;
880  size_t offset;
881 } __Pyx_StructField;
882 typedef struct {
883  __Pyx_StructField* field;
884  size_t parent_offset;
885 } __Pyx_BufFmt_StackElem;
886 typedef struct {
887  __Pyx_StructField root;
888  __Pyx_BufFmt_StackElem* head;
889  size_t fmt_offset;
890  size_t new_count, enc_count;
891  size_t struct_alignment;
892  int is_complex;
893  char enc_type;
894  char new_packmode;
895  char enc_packmode;
896  char is_valid_array;
897 } __Pyx_BufFmt_Context;
898 
899 
900 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":690
901  * # in Cython to enable them only on the right systems.
902  *
903  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
904  * ctypedef npy_int16 int16_t
905  * ctypedef npy_int32 int32_t
906  */
907 typedef npy_int8 __pyx_t_5numpy_int8_t;
908 
909 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":691
910  *
911  * ctypedef npy_int8 int8_t
912  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
913  * ctypedef npy_int32 int32_t
914  * ctypedef npy_int64 int64_t
915  */
916 typedef npy_int16 __pyx_t_5numpy_int16_t;
917 
918 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":692
919  * ctypedef npy_int8 int8_t
920  * ctypedef npy_int16 int16_t
921  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
922  * ctypedef npy_int64 int64_t
923  * #ctypedef npy_int96 int96_t
924  */
925 typedef npy_int32 __pyx_t_5numpy_int32_t;
926 
927 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":693
928  * ctypedef npy_int16 int16_t
929  * ctypedef npy_int32 int32_t
930  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
931  * #ctypedef npy_int96 int96_t
932  * #ctypedef npy_int128 int128_t
933  */
934 typedef npy_int64 __pyx_t_5numpy_int64_t;
935 
936 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":697
937  * #ctypedef npy_int128 int128_t
938  *
939  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
940  * ctypedef npy_uint16 uint16_t
941  * ctypedef npy_uint32 uint32_t
942  */
943 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
944 
945 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":698
946  *
947  * ctypedef npy_uint8 uint8_t
948  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
949  * ctypedef npy_uint32 uint32_t
950  * ctypedef npy_uint64 uint64_t
951  */
952 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
953 
954 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":699
955  * ctypedef npy_uint8 uint8_t
956  * ctypedef npy_uint16 uint16_t
957  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
958  * ctypedef npy_uint64 uint64_t
959  * #ctypedef npy_uint96 uint96_t
960  */
961 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
962 
963 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":700
964  * ctypedef npy_uint16 uint16_t
965  * ctypedef npy_uint32 uint32_t
966  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
967  * #ctypedef npy_uint96 uint96_t
968  * #ctypedef npy_uint128 uint128_t
969  */
970 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
971 
972 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":704
973  * #ctypedef npy_uint128 uint128_t
974  *
975  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
976  * ctypedef npy_float64 float64_t
977  * #ctypedef npy_float80 float80_t
978  */
979 typedef npy_float32 __pyx_t_5numpy_float32_t;
980 
981 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":705
982  *
983  * ctypedef npy_float32 float32_t
984  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
985  * #ctypedef npy_float80 float80_t
986  * #ctypedef npy_float128 float128_t
987  */
988 typedef npy_float64 __pyx_t_5numpy_float64_t;
989 
990 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":714
991  * # The int types are mapped a bit surprising --
992  * # numpy.int corresponds to 'l' and numpy.long to 'q'
993  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
994  * ctypedef npy_longlong long_t
995  * ctypedef npy_longlong longlong_t
996  */
997 typedef npy_long __pyx_t_5numpy_int_t;
998 
999 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":715
1000  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1001  * ctypedef npy_long int_t
1002  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1003  * ctypedef npy_longlong longlong_t
1004  *
1005  */
1006 typedef npy_longlong __pyx_t_5numpy_long_t;
1007 
1008 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":716
1009  * ctypedef npy_long int_t
1010  * ctypedef npy_longlong long_t
1011  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1012  *
1013  * ctypedef npy_ulong uint_t
1014  */
1015 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1016 
1017 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":718
1018  * ctypedef npy_longlong longlong_t
1019  *
1020  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1021  * ctypedef npy_ulonglong ulong_t
1022  * ctypedef npy_ulonglong ulonglong_t
1023  */
1024 typedef npy_ulong __pyx_t_5numpy_uint_t;
1025 
1026 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":719
1027  *
1028  * ctypedef npy_ulong uint_t
1029  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1030  * ctypedef npy_ulonglong ulonglong_t
1031  *
1032  */
1033 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1034 
1035 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":720
1036  * ctypedef npy_ulong uint_t
1037  * ctypedef npy_ulonglong ulong_t
1038  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1039  *
1040  * ctypedef npy_intp intp_t
1041  */
1042 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1043 
1044 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":722
1045  * ctypedef npy_ulonglong ulonglong_t
1046  *
1047  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1048  * ctypedef npy_uintp uintp_t
1049  *
1050  */
1051 typedef npy_intp __pyx_t_5numpy_intp_t;
1052 
1053 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":723
1054  *
1055  * ctypedef npy_intp intp_t
1056  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1057  *
1058  * ctypedef npy_double float_t
1059  */
1060 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1061 
1062 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":725
1063  * ctypedef npy_uintp uintp_t
1064  *
1065  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1066  * ctypedef npy_double double_t
1067  * ctypedef npy_longdouble longdouble_t
1068  */
1069 typedef npy_double __pyx_t_5numpy_float_t;
1070 
1071 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":726
1072  *
1073  * ctypedef npy_double float_t
1074  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1075  * ctypedef npy_longdouble longdouble_t
1076  *
1077  */
1078 typedef npy_double __pyx_t_5numpy_double_t;
1079 
1080 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":727
1081  * ctypedef npy_double float_t
1082  * ctypedef npy_double double_t
1083  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1084  *
1085  * ctypedef npy_cfloat cfloat_t
1086  */
1087 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1088 
1089 /* "subsurfaceTransportFunctions.pyx":14
1090  * cdef inline double double_min(double a, double b): return a if a <= b else b
1091  *
1092  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
1093  * #numpy.intc_t not in cython's numpy.pxd
1094  * ctypedef int ITYPE_t
1095  */
1096 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
1097 
1098 /* "subsurfaceTransportFunctions.pyx":16
1099  * ctypedef numpy.double_t DTYPE_t
1100  * #numpy.intc_t not in cython's numpy.pxd
1101  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
1102  *
1103  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
1104  */
1105 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
1106 /* Declarations.proto */
1107 #if CYTHON_CCOMPLEX
1108  #ifdef __cplusplus
1109  typedef ::std::complex< float > __pyx_t_float_complex;
1110  #else
1111  typedef float _Complex __pyx_t_float_complex;
1112  #endif
1113 #else
1114  typedef struct { float real, imag; } __pyx_t_float_complex;
1115 #endif
1116 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1117 
1118 /* Declarations.proto */
1119 #if CYTHON_CCOMPLEX
1120  #ifdef __cplusplus
1121  typedef ::std::complex< double > __pyx_t_double_complex;
1122  #else
1123  typedef double _Complex __pyx_t_double_complex;
1124  #endif
1125 #else
1126  typedef struct { double real, imag; } __pyx_t_double_complex;
1127 #endif
1128 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1129 
1130 
1131 /*--- Type declarations ---*/
1132 
1133 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":729
1134  * ctypedef npy_longdouble longdouble_t
1135  *
1136  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1137  * ctypedef npy_cdouble cdouble_t
1138  * ctypedef npy_clongdouble clongdouble_t
1139  */
1140 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1141 
1142 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":730
1143  *
1144  * ctypedef npy_cfloat cfloat_t
1145  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1146  * ctypedef npy_clongdouble clongdouble_t
1147  *
1148  */
1149 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1150 
1151 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":731
1152  * ctypedef npy_cfloat cfloat_t
1153  * ctypedef npy_cdouble cdouble_t
1154  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1155  *
1156  * ctypedef npy_cdouble complex_t
1157  */
1158 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1159 
1160 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":733
1161  * ctypedef npy_clongdouble clongdouble_t
1162  *
1163  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1164  *
1165  * cdef inline object PyArray_MultiIterNew1(a):
1166  */
1167 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1168 
1169 /* --- Runtime support code (head) --- */
1170 /* Refnanny.proto */
1171 #ifndef CYTHON_REFNANNY
1172  #define CYTHON_REFNANNY 0
1173 #endif
1174 #if CYTHON_REFNANNY
1175  typedef struct {
1176  void (*INCREF)(void*, PyObject*, int);
1177  void (*DECREF)(void*, PyObject*, int);
1178  void (*GOTREF)(void*, PyObject*, int);
1179  void (*GIVEREF)(void*, PyObject*, int);
1180  void* (*SetupContext)(const char*, int, const char*);
1181  void (*FinishContext)(void**);
1182  } __Pyx_RefNannyAPIStruct;
1183  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1184  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1185  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1186 #ifdef WITH_THREAD
1187  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1188  if (acquire_gil) {\
1189  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1190  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1191  PyGILState_Release(__pyx_gilstate_save);\
1192  } else {\
1193  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1194  }
1195 #else
1196  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1197  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1198 #endif
1199  #define __Pyx_RefNannyFinishContext()\
1200  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1201  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1202  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1203  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1204  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1205  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1206  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1207  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1208  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1209 #else
1210  #define __Pyx_RefNannyDeclarations
1211  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1212  #define __Pyx_RefNannyFinishContext()
1213  #define __Pyx_INCREF(r) Py_INCREF(r)
1214  #define __Pyx_DECREF(r) Py_DECREF(r)
1215  #define __Pyx_GOTREF(r)
1216  #define __Pyx_GIVEREF(r)
1217  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1218  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1219  #define __Pyx_XGOTREF(r)
1220  #define __Pyx_XGIVEREF(r)
1221 #endif
1222 #define __Pyx_XDECREF_SET(r, v) do {\
1223  PyObject *tmp = (PyObject *) r;\
1224  r = v; __Pyx_XDECREF(tmp);\
1225  } while (0)
1226 #define __Pyx_DECREF_SET(r, v) do {\
1227  PyObject *tmp = (PyObject *) r;\
1228  r = v; __Pyx_DECREF(tmp);\
1229  } while (0)
1230 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1231 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1232 
1233 /* PyObjectGetAttrStr.proto */
1234 #if CYTHON_USE_TYPE_SLOTS
1235 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1236 #else
1237 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1238 #endif
1239 
1240 /* GetBuiltinName.proto */
1241 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1242 
1243 /* RaiseArgTupleInvalid.proto */
1244 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1245  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1246 
1247 /* RaiseDoubleKeywords.proto */
1248 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1249 
1250 /* ParseKeywords.proto */
1251 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1252  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1253  const char* function_name);
1254 
1255 /* ArgTypeTest.proto */
1256 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1257  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1258  __Pyx__ArgTypeTest(obj, type, name, exact))
1259 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1260 
1261 /* IsLittleEndian.proto */
1262 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1263 
1264 /* BufferFormatCheck.proto */
1265 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1266 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1267  __Pyx_BufFmt_StackElem* stack,
1268  __Pyx_TypeInfo* type);
1269 
1270 /* BufferGetAndValidate.proto */
1271 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1272  ((obj == Py_None || obj == NULL) ?\
1273  (__Pyx_ZeroBuffer(buf), 0) :\
1274  __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1275 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1276  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1277 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1278 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1279 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1280 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1281 
1282 /* BufferIndexError.proto */
1283 static void __Pyx_RaiseBufferIndexError(int axis);
1284 
1285 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1286 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1287 /* PyThreadStateGet.proto */
1288 #if CYTHON_FAST_THREAD_STATE
1289 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1290 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1291 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1292 #else
1293 #define __Pyx_PyThreadState_declare
1294 #define __Pyx_PyThreadState_assign
1295 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1296 #endif
1297 
1298 /* PyErrFetchRestore.proto */
1299 #if CYTHON_FAST_THREAD_STATE
1300 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1301 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1302 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1303 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1304 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1305 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1306 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1307 #if CYTHON_COMPILING_IN_CPYTHON
1308 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1309 #else
1310 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1311 #endif
1312 #else
1313 #define __Pyx_PyErr_Clear() PyErr_Clear()
1314 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1315 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1316 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1317 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1318 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1319 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1320 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1321 #endif
1322 
1323 /* DictGetItem.proto */
1324 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1325 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1326 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1327  (likely(PyDict_CheckExact(obj)) ?\
1328  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1329 #else
1330 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1331 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1332 #endif
1333 
1334 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1335 /* GetItemInt.proto */
1336 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1337  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1338  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1339  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1340  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1341 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1342  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1343  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1344  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1345 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1346  int wraparound, int boundscheck);
1347 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1348  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1349  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1350  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1351 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1352  int wraparound, int boundscheck);
1353 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1354 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1355  int is_list, int wraparound, int boundscheck);
1356 
1357 /* ObjectGetItem.proto */
1358 #if CYTHON_USE_TYPE_SLOTS
1359 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1360 #else
1361 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1362 #endif
1363 
1364 /* PyFloatBinop.proto */
1365 #if !CYTHON_COMPILING_IN_PYPY
1366 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1367 #else
1368 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
1369  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1370 #endif
1371 
1372 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1373 /* PyFunctionFastCall.proto */
1374 #if CYTHON_FAST_PYCALL
1375 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1376  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1377 #if 1 || PY_VERSION_HEX < 0x030600B1
1378 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1379 #else
1380 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1381 #endif
1382 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1383  (sizeof(char [1 - 2*!(cond)]) - 1)
1384 #ifndef Py_MEMBER_SIZE
1385 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1386 #endif
1387  static size_t __pyx_pyframe_localsplus_offset = 0;
1388  #include "frameobject.h"
1389  #define __Pxy_PyFrame_Initialize_Offsets()\
1390  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1391  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1392  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1393  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1394 #endif
1395 
1396 /* PyCFunctionFastCall.proto */
1397 #if CYTHON_FAST_PYCCALL
1398 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1399 #else
1400 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1401 #endif
1402 
1403 /* PyObjectCall.proto */
1404 #if CYTHON_COMPILING_IN_CPYTHON
1405 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1406 #else
1407 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1408 #endif
1409 
1410 /* PyDictVersioning.proto */
1411 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1412 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1413 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1414 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1415  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1416  (cache_var) = (value);
1417 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1418  static PY_UINT64_T __pyx_dict_version = 0;\
1419  static PyObject *__pyx_dict_cached_value = NULL;\
1420  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1421  (VAR) = __pyx_dict_cached_value;\
1422  } else {\
1423  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1424  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1425  }\
1426 }
1427 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1428 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1429 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1430 #else
1431 #define __PYX_GET_DICT_VERSION(dict) (0)
1432 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1433 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1434 #endif
1435 
1436 /* GetModuleGlobalName.proto */
1437 #if CYTHON_USE_DICT_VERSIONS
1438 #define __Pyx_GetModuleGlobalName(var, name) {\
1439  static PY_UINT64_T __pyx_dict_version = 0;\
1440  static PyObject *__pyx_dict_cached_value = NULL;\
1441  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1442  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1443  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1444 }
1445 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1446  PY_UINT64_T __pyx_dict_version;\
1447  PyObject *__pyx_dict_cached_value;\
1448  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1449 }
1450 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1451 #else
1452 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1453 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1454 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1455 #endif
1456 
1457 /* ExtTypeTest.proto */
1458 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1459 
1460 /* PyObjectCall2Args.proto */
1461 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1462 
1463 /* PyObjectCallMethO.proto */
1464 #if CYTHON_COMPILING_IN_CPYTHON
1465 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1466 #endif
1467 
1468 /* PyObjectCallOneArg.proto */
1469 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1470 
1471 /* pyobject_as_double.proto */
1472 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1473 #if CYTHON_COMPILING_IN_PYPY
1474 #define __Pyx_PyObject_AsDouble(obj)\
1475 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1476  likely(PyInt_CheckExact(obj)) ?\
1477  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1478 #else
1479 #define __Pyx_PyObject_AsDouble(obj)\
1480 ((likely(PyFloat_CheckExact(obj))) ?\
1481  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1482 #endif
1483 
1484 /* GetTopmostException.proto */
1485 #if CYTHON_USE_EXC_INFO_STACK
1486 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1487 #endif
1488 
1489 /* SaveResetException.proto */
1490 #if CYTHON_FAST_THREAD_STATE
1491 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1492 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1493 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1494 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1495 #else
1496 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1497 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1498 #endif
1499 
1500 /* PyErrExceptionMatches.proto */
1501 #if CYTHON_FAST_THREAD_STATE
1502 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1503 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1504 #else
1505 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1506 #endif
1507 
1508 /* GetException.proto */
1509 #if CYTHON_FAST_THREAD_STATE
1510 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1511 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1512 #else
1513 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1514 #endif
1515 
1516 /* RaiseException.proto */
1517 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1518 
1519 /* TypeImport.proto */
1520 #ifndef __PYX_HAVE_RT_ImportType_proto
1521 #define __PYX_HAVE_RT_ImportType_proto
1522 enum __Pyx_ImportType_CheckSize {
1523  __Pyx_ImportType_CheckSize_Error = 0,
1524  __Pyx_ImportType_CheckSize_Warn = 1,
1525  __Pyx_ImportType_CheckSize_Ignore = 2
1526 };
1527 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1528 #endif
1529 
1530 /* Import.proto */
1531 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1532 
1533 /* CLineInTraceback.proto */
1534 #ifdef CYTHON_CLINE_IN_TRACEBACK
1535 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1536 #else
1537 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1538 #endif
1539 
1540 /* CodeObjectCache.proto */
1541 typedef struct {
1542  PyCodeObject* code_object;
1543  int code_line;
1544 } __Pyx_CodeObjectCacheEntry;
1545 struct __Pyx_CodeObjectCache {
1546  int count;
1547  int max_count;
1548  __Pyx_CodeObjectCacheEntry* entries;
1549 };
1550 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1551 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1552 static PyCodeObject *__pyx_find_code_object(int code_line);
1553 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1554 
1555 /* AddTraceback.proto */
1556 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1557  int py_line, const char *filename);
1558 
1559 /* BufferStructDeclare.proto */
1560 typedef struct {
1561  Py_ssize_t shape, strides, suboffsets;
1562 } __Pyx_Buf_DimInfo;
1563 typedef struct {
1564  size_t refcount;
1565  Py_buffer pybuffer;
1566 } __Pyx_Buffer;
1567 typedef struct {
1568  __Pyx_Buffer *rcbuffer;
1569  char *data;
1570  __Pyx_Buf_DimInfo diminfo[8];
1571 } __Pyx_LocalBuf_ND;
1572 
1573 #if PY_MAJOR_VERSION < 3
1574  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1575  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1576 #else
1577  #define __Pyx_GetBuffer PyObject_GetBuffer
1578  #define __Pyx_ReleaseBuffer PyBuffer_Release
1579 #endif
1580 
1581 
1582 /* GCCDiagnostics.proto */
1583 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1584 #define __Pyx_HAS_GCC_DIAGNOSTIC
1585 #endif
1586 
1587 /* RealImag.proto */
1588 #if CYTHON_CCOMPLEX
1589  #ifdef __cplusplus
1590  #define __Pyx_CREAL(z) ((z).real())
1591  #define __Pyx_CIMAG(z) ((z).imag())
1592  #else
1593  #define __Pyx_CREAL(z) (__real__(z))
1594  #define __Pyx_CIMAG(z) (__imag__(z))
1595  #endif
1596 #else
1597  #define __Pyx_CREAL(z) ((z).real)
1598  #define __Pyx_CIMAG(z) ((z).imag)
1599 #endif
1600 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1601  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1602  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1603  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1604 #else
1605  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1606  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1607 #endif
1608 
1609 /* Arithmetic.proto */
1610 #if CYTHON_CCOMPLEX
1611  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1612  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1613  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1614  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1615  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1616  #define __Pyx_c_neg_float(a) (-(a))
1617  #ifdef __cplusplus
1618  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1619  #define __Pyx_c_conj_float(z) (::std::conj(z))
1620  #if 1
1621  #define __Pyx_c_abs_float(z) (::std::abs(z))
1622  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1623  #endif
1624  #else
1625  #define __Pyx_c_is_zero_float(z) ((z)==0)
1626  #define __Pyx_c_conj_float(z) (conjf(z))
1627  #if 1
1628  #define __Pyx_c_abs_float(z) (cabsf(z))
1629  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1630  #endif
1631  #endif
1632 #else
1633  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1634  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1635  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1636  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1637  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1638  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1639  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1640  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1641  #if 1
1642  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1643  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1644  #endif
1645 #endif
1646 
1647 /* Arithmetic.proto */
1648 #if CYTHON_CCOMPLEX
1649  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1650  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1651  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1652  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1653  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1654  #define __Pyx_c_neg_double(a) (-(a))
1655  #ifdef __cplusplus
1656  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1657  #define __Pyx_c_conj_double(z) (::std::conj(z))
1658  #if 1
1659  #define __Pyx_c_abs_double(z) (::std::abs(z))
1660  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1661  #endif
1662  #else
1663  #define __Pyx_c_is_zero_double(z) ((z)==0)
1664  #define __Pyx_c_conj_double(z) (conj(z))
1665  #if 1
1666  #define __Pyx_c_abs_double(z) (cabs(z))
1667  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1668  #endif
1669  #endif
1670 #else
1671  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1672  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1673  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1674  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1675  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1676  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1677  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1678  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1679  #if 1
1680  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1681  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1682  #endif
1683 #endif
1684 
1685 /* CIntFromPy.proto */
1686 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1687 
1688 /* CIntToPy.proto */
1689 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1690 
1691 /* CIntToPy.proto */
1692 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1693 
1694 /* CIntFromPy.proto */
1695 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1696 
1697 /* CIntToPy.proto */
1698 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1699 
1700 /* CIntFromPy.proto */
1701 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1702 
1703 /* FastTypeChecks.proto */
1704 #if CYTHON_COMPILING_IN_CPYTHON
1705 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1706 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1707 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1708 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1709 #else
1710 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1711 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1712 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1713 #endif
1714 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1715 
1716 /* CheckBinaryVersion.proto */
1717 static int __Pyx_check_binary_version(void);
1718 
1719 /* InitStrings.proto */
1720 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1721 
1722 
1723 /* Module declarations from 'cpython.buffer' */
1724 
1725 /* Module declarations from 'libc.string' */
1726 
1727 /* Module declarations from 'libc.stdio' */
1728 
1729 /* Module declarations from '__builtin__' */
1730 
1731 /* Module declarations from 'cpython.type' */
1732 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1733 
1734 /* Module declarations from 'cpython' */
1735 
1736 /* Module declarations from 'cpython.object' */
1737 
1738 /* Module declarations from 'cpython.ref' */
1739 
1740 /* Module declarations from 'cpython.mem' */
1741 
1742 /* Module declarations from 'numpy' */
1743 
1744 /* Module declarations from 'numpy' */
1745 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1746 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1747 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1748 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1749 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
1750 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
1751 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
1752 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
1753 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
1754 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
1755 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
1756 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
1757 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
1758 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
1759 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1760 
1761 /* Module declarations from 'subsurfaceTransportFunctions' */
1762 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1763 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1764 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1765 extern int __pyx_module_is_main_subsurfaceTransportFunctions;
1766 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1767 
1768 /* Implementation of 'subsurfaceTransportFunctions' */
1769 static PyObject *__pyx_builtin_range;
1770 static PyObject *__pyx_builtin_ImportError;
1771 static const char __pyx_k_I[] = "I";
1772 static const char __pyx_k_J[] = "J";
1773 static const char __pyx_k_d[] = "d";
1774 static const char __pyx_k_i[] = "i";
1775 static const char __pyx_k_j[] = "j";
1776 static const char __pyx_k_k[] = "k";
1777 static const char __pyx_k_m[] = "m";
1778 static const char __pyx_k_n[] = "n";
1779 static const char __pyx_k_q[] = "q";
1780 static const char __pyx_k_t[] = "t";
1781 static const char __pyx_k_v[] = "v";
1782 static const char __pyx_k_w[] = "w";
1783 static const char __pyx_k_x[] = "x";
1784 static const char __pyx_k_dS[] = "dS";
1785 static const char __pyx_k_dV[] = "dV";
1786 static const char __pyx_k_df[] = "df";
1787 static const char __pyx_k_dm[] = "dm";
1788 static const char __pyx_k_eN[] = "eN";
1789 static const char __pyx_k_ii[] = "ii";
1790 static const char __pyx_k_kb[] = "kb";
1791 static const char __pyx_k_mt[] = "mt";
1792 static const char __pyx_k_nd[] = "nd";
1793 static const char __pyx_k_pi[] = "pi";
1794 static const char __pyx_k_xc[] = "xc";
1795 static const char __pyx_k_yc[] = "yc";
1796 static const char __pyx_k_KWr[] = "KWr";
1797 static const char __pyx_k_KWs[] = "KWs";
1798 static const char __pyx_k_dmt[] = "dmt";
1799 static const char __pyx_k_dot[] = "dot";
1800 static const char __pyx_k_ebN[] = "ebN";
1801 static const char __pyx_k_l2g[] = "l2g";
1802 static const char __pyx_k_nnz[] = "nnz";
1803 static const char __pyx_k_q_m[] = "q_m";
1804 static const char __pyx_k_q_r[] = "q_r";
1805 static const char __pyx_k_q_u[] = "q_u";
1806 static const char __pyx_k_q_x[] = "q_x";
1807 static const char __pyx_k_rho[] = "rho";
1808 static const char __pyx_k_sum[] = "sum";
1809 static const char __pyx_k_u_j[] = "u_j";
1810 static const char __pyx_k_vol[] = "vol";
1811 static const char __pyx_k_a_eN[] = "a_eN";
1812 static const char __pyx_k_a_up[] = "a_up";
1813 static const char __pyx_k_beta[] = "beta";
1814 static const char __pyx_k_ebNE[] = "ebNE";
1815 static const char __pyx_k_f_up[] = "f_up";
1816 static const char __pyx_k_flat[] = "flat";
1817 static const char __pyx_k_flux[] = "flux";
1818 static const char __pyx_k_main[] = "__main__";
1819 static const char __pyx_k_name[] = "__name__";
1820 static const char __pyx_k_one8[] = "one8";
1821 static const char __pyx_k_psiC[] = "psiC";
1822 static const char __pyx_k_q_dm[] = "q_dm";
1823 static const char __pyx_k_q_kr[] = "q_kr";
1824 static const char __pyx_k_q_mt[] = "q_mt";
1825 static const char __pyx_k_rho2[] = "rho2";
1826 static const char __pyx_k_rhom[] = "rhom";
1827 static const char __pyx_k_sBar[] = "sBar";
1828 static const char __pyx_k_test[] = "__test__";
1829 static const char __pyx_k_u_eN[] = "u_eN";
1830 static const char __pyx_k_vBar[] = "vBar";
1831 static const char __pyx_k_a_avg[] = "a_avg";
1832 static const char __pyx_k_alpha[] = "alpha";
1833 static const char __pyx_k_clock[] = "clock";
1834 static const char __pyx_k_denom[] = "denom";
1835 static const char __pyx_k_drhom[] = "drhom";
1836 static const char __pyx_k_kr_eN[] = "kr_eN";
1837 static const char __pyx_k_matID[] = "matID";
1838 static const char __pyx_k_numer[] = "numer";
1839 static const char __pyx_k_numpy[] = "numpy";
1840 static const char __pyx_k_pcBar[] = "pcBar";
1841 static const char __pyx_k_q_dkr[] = "q_dkr";
1842 static const char __pyx_k_q_dmt[] = "q_dmt";
1843 static const char __pyx_k_range[] = "range";
1844 static const char __pyx_k_shape[] = "shape";
1845 static const char __pyx_k_u_dof[] = "u_dof";
1846 static const char __pyx_k_u_l2g[] = "u_l2g";
1847 static const char __pyx_k_vBar2[] = "vBar2";
1848 static const char __pyx_k_vol_e[] = "vol_e";
1849 static const char __pyx_k_zeros[] = "zeros";
1850 static const char __pyx_k_a_neig[] = "a_neig";
1851 static const char __pyx_k_colind[] = "colind";
1852 static const char __pyx_k_dkr_up[] = "dkr_up";
1853 static const char __pyx_k_import[] = "__import__";
1854 static const char __pyx_k_mt_avg[] = "mt_avg";
1855 static const char __pyx_k_nSpace[] = "nSpace";
1856 static const char __pyx_k_phi_eN[] = "phi_eN";
1857 static const char __pyx_k_picard[] = "picard";
1858 static const char __pyx_k_q_alin[] = "q_alin";
1859 static const char __pyx_k_q_detJ[] = "q_detJ";
1860 static const char __pyx_k_q_flin[] = "q_flin";
1861 static const char __pyx_k_q_mass[] = "q_mass";
1862 static const char __pyx_k_q_vals[] = "q_vals";
1863 static const char __pyx_k_rowptr[] = "rowptr";
1864 static const char __pyx_k_thetaR[] = "thetaR";
1865 static const char __pyx_k_thetaS[] = "thetaS";
1866 static const char __pyx_k_thetaW[] = "thetaW";
1867 static const char __pyx_k_u_neig[] = "u_neig";
1868 static const char __pyx_k_volume[] = "volume";
1869 static const char __pyx_k_weight[] = "weight";
1870 static const char __pyx_k_df_dofs[] = "df_dofs";
1871 static const char __pyx_k_eN_left[] = "eN_left";
1872 static const char __pyx_k_gravity[] = "gravity";
1873 static const char __pyx_k_kr_neig[] = "kr_neig";
1874 static const char __pyx_k_nSpace2[] = "nSpace2";
1875 static const char __pyx_k_omega_e[] = "omega_e";
1876 static const char __pyx_k_pcBar_n[] = "pcBar_n";
1877 static const char __pyx_k_q_dmass[] = "q_dmass";
1878 static const char __pyx_k_q_kr_up[] = "q_kr_up";
1879 static const char __pyx_k_thetaSR[] = "thetaSR";
1880 static const char __pyx_k_dmtj_avg[] = "dmtj_avg";
1881 static const char __pyx_k_eN_right[] = "eN_right";
1882 static const char __pyx_k_ebq_vals[] = "ebq_vals";
1883 static const char __pyx_k_integral[] = "integral";
1884 static const char __pyx_k_material[] = "material";
1885 static const char __pyx_k_phi_neig[] = "phi_neig";
1886 static const char __pyx_k_q_grad_u[] = "q_grad_u";
1887 static const char __pyx_k_q_grad_v[] = "q_grad_v";
1888 static const char __pyx_k_q_grad_w[] = "q_grad_w";
1889 static const char __pyx_k_ebN_local[] = "ebN_local";
1890 static const char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1891 static const char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1892 static const char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1893 static const char __pyx_k_transient[] = "transient";
1894 static const char __pyx_k_volFactor[] = "volFactor";
1895 static const char __pyx_k_zVelocity[] = "zVelocity";
1896 static const char __pyx_k_zvelocity[] = "zvelocity";
1897 static const char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1898 static const char __pyx_k_matID_neig[] = "matID_neig";
1899 static const char __pyx_k_nAvgWeight[] = "nAvgWeight";
1900 static const char __pyx_k_upwindFlag[] = "upwindFlag";
1901 static const char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1902 static const char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1903 static const char __pyx_k_ImportError[] = "ImportError";
1904 static const char __pyx_k_eN_neighbor[] = "eN_neighbor";
1905 static const char __pyx_k_tForReversal[] = "tForReversal";
1906 static const char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1907 static const char __pyx_k_material_left[] = "material_left";
1908 static const char __pyx_k_weak_residual[] = "weak_residual";
1909 static const char __pyx_k_material_right[] = "material_right";
1910 static const char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1911 static const char __pyx_k_elementJacobian[] = "elementJacobian";
1912 static const char __pyx_k_elementResidual[] = "elementResidual";
1913 static const char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
1914 static const char __pyx_k_nElements_global[] = "nElements_global";
1915 static const char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
1916 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1917 static const char __pyx_k_material_functions[] = "material_functions";
1918 static const char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
1919 static const char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
1920 static const char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
1921 static const char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
1922 static const char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
1923 static const char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
1924 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
1925 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
1926 static const char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
1927 static const char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
1928 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
1929 static const char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
1930 static const char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
1931 static const char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
1932 static const char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
1933 static const char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
1934 static const char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
1935 static const char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
1936 static const char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
1937 static const char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
1938 static const char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
1939 static const char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
1940 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
1941 static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
1942 static const char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
1943 static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
1944 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1945 static const char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
1946 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
1947 static const char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
1948 static const char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
1949 static const char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1950 static const char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
1951 static const char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
1952 static const char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
1953 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1954 static const char __pyx_k_proteus_subsurfaceTransportFunct[] = "proteus/subsurfaceTransportFunctions.pyx";
1955 static const char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
1956 static const char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
1957 static const char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1958 static const char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1959 static const char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
1960 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
1961 static const char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
1962 static const char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1963 static const char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1964 static const char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1965 static const char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
1966 static const char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1967 static const char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1968 static PyObject *__pyx_n_s_DKWr_DpsiC;
1969 static PyObject *__pyx_n_s_DsBar_DpsiC;
1970 static PyObject *__pyx_n_s_DthetaW_DpsiC;
1971 static PyObject *__pyx_n_s_DvBar_DpsiC;
1972 static PyObject *__pyx_n_s_I;
1973 static PyObject *__pyx_n_s_ImportError;
1974 static PyObject *__pyx_n_s_J;
1975 static PyObject *__pyx_n_s_KWr;
1976 static PyObject *__pyx_n_s_KWs;
1977 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
1978 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
1979 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
1980 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
1981 static PyObject *__pyx_n_s_a_avg;
1982 static PyObject *__pyx_n_s_a_eN;
1983 static PyObject *__pyx_n_s_a_neig;
1984 static PyObject *__pyx_n_s_a_up;
1985 static PyObject *__pyx_n_s_alpha;
1986 static PyObject *__pyx_n_s_beta;
1987 static PyObject *__pyx_n_s_calculateNormalFlux;
1988 static PyObject *__pyx_n_s_characteristic_velocity;
1989 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
1990 static PyObject *__pyx_n_s_cline_in_traceback;
1991 static PyObject *__pyx_n_s_clock;
1992 static PyObject *__pyx_n_s_colind;
1993 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
1994 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
1995 static PyObject *__pyx_n_s_d;
1996 static PyObject *__pyx_n_s_dS;
1997 static PyObject *__pyx_n_s_dV;
1998 static PyObject *__pyx_n_s_denom;
1999 static PyObject *__pyx_n_s_df;
2000 static PyObject *__pyx_n_s_df_dofs;
2001 static PyObject *__pyx_n_s_dkr_up;
2002 static PyObject *__pyx_n_s_dm;
2003 static PyObject *__pyx_n_s_dmt;
2004 static PyObject *__pyx_n_s_dmtj_avg;
2005 static PyObject *__pyx_n_s_dot;
2006 static PyObject *__pyx_n_s_drhom;
2007 static PyObject *__pyx_n_s_eN;
2008 static PyObject *__pyx_n_s_eN_left;
2009 static PyObject *__pyx_n_s_eN_neighbor;
2010 static PyObject *__pyx_n_s_eN_right;
2011 static PyObject *__pyx_n_s_ebN;
2012 static PyObject *__pyx_n_s_ebNE;
2013 static PyObject *__pyx_n_s_ebN_local;
2014 static PyObject *__pyx_n_s_ebq_global_vals;
2015 static PyObject *__pyx_n_s_ebq_vals;
2016 static PyObject *__pyx_n_s_elementBarycentersArray;
2017 static PyObject *__pyx_n_s_elementBoundariesArray;
2018 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
2019 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
2020 static PyObject *__pyx_n_s_elementBoundaryTypes;
2021 static PyObject *__pyx_n_s_elementJacobian;
2022 static PyObject *__pyx_n_s_elementMaterialTypes;
2023 static PyObject *__pyx_n_s_elementNeighborsArray;
2024 static PyObject *__pyx_n_s_elementResidual;
2025 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
2026 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
2027 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
2028 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
2029 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
2030 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
2031 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
2032 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
2033 static PyObject *__pyx_n_s_f_up;
2034 static PyObject *__pyx_n_s_flat;
2035 static PyObject *__pyx_n_s_flux;
2036 static PyObject *__pyx_n_s_gravity;
2037 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
2038 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
2039 static PyObject *__pyx_n_s_i;
2040 static PyObject *__pyx_n_s_ii;
2041 static PyObject *__pyx_n_s_import;
2042 static PyObject *__pyx_n_s_integral;
2043 static PyObject *__pyx_n_s_j;
2044 static PyObject *__pyx_n_s_jacobian_weak_residual;
2045 static PyObject *__pyx_n_s_k;
2046 static PyObject *__pyx_n_s_kb;
2047 static PyObject *__pyx_n_s_kr_eN;
2048 static PyObject *__pyx_n_s_kr_neig;
2049 static PyObject *__pyx_n_s_l2g;
2050 static PyObject *__pyx_n_s_m;
2051 static PyObject *__pyx_n_s_main;
2052 static PyObject *__pyx_n_s_matID;
2053 static PyObject *__pyx_n_s_matID_neig;
2054 static PyObject *__pyx_n_s_material;
2055 static PyObject *__pyx_n_s_material_functions;
2056 static PyObject *__pyx_n_s_material_left;
2057 static PyObject *__pyx_n_s_material_right;
2058 static PyObject *__pyx_n_s_mt;
2059 static PyObject *__pyx_n_s_mt_avg;
2060 static PyObject *__pyx_n_s_n;
2061 static PyObject *__pyx_n_s_nAvgWeight;
2062 static PyObject *__pyx_n_s_nDOF_test_element;
2063 static PyObject *__pyx_n_s_nDOF_trial_element;
2064 static PyObject *__pyx_n_s_nElementBoundaries_element;
2065 static PyObject *__pyx_n_s_nElementBoundaries_global;
2066 static PyObject *__pyx_n_s_nElements_global;
2067 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
2068 static PyObject *__pyx_n_s_nSpace;
2069 static PyObject *__pyx_n_s_nSpace2;
2070 static PyObject *__pyx_n_s_name;
2071 static PyObject *__pyx_n_s_nd;
2072 static PyObject *__pyx_n_s_nnz;
2073 static PyObject *__pyx_n_s_numer;
2074 static PyObject *__pyx_n_s_numpy;
2075 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2076 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2077 static PyObject *__pyx_n_s_omega_e;
2078 static PyObject *__pyx_n_s_one8;
2079 static PyObject *__pyx_n_s_onePlus_pcBar_n;
2080 static PyObject *__pyx_n_s_pcBar;
2081 static PyObject *__pyx_n_s_pcBar_n;
2082 static PyObject *__pyx_n_s_pcBar_nM1;
2083 static PyObject *__pyx_n_s_pcBar_nM2;
2084 static PyObject *__pyx_n_s_phi_eN;
2085 static PyObject *__pyx_n_s_phi_neig;
2086 static PyObject *__pyx_n_s_pi;
2087 static PyObject *__pyx_n_s_picard;
2088 static PyObject *__pyx_kp_s_proteus_subsurfaceTransportFunct;
2089 static PyObject *__pyx_n_s_psiC;
2090 static PyObject *__pyx_n_s_q;
2091 static PyObject *__pyx_n_s_q_alin;
2092 static PyObject *__pyx_n_s_q_detJ;
2093 static PyObject *__pyx_n_s_q_dkr;
2094 static PyObject *__pyx_n_s_q_dm;
2095 static PyObject *__pyx_n_s_q_dmass;
2096 static PyObject *__pyx_n_s_q_dmt;
2097 static PyObject *__pyx_n_s_q_flin;
2098 static PyObject *__pyx_n_s_q_grad_u;
2099 static PyObject *__pyx_n_s_q_grad_v;
2100 static PyObject *__pyx_n_s_q_grad_w;
2101 static PyObject *__pyx_n_s_q_kr;
2102 static PyObject *__pyx_n_s_q_kr_up;
2103 static PyObject *__pyx_n_s_q_m;
2104 static PyObject *__pyx_n_s_q_mass;
2105 static PyObject *__pyx_n_s_q_mt;
2106 static PyObject *__pyx_n_s_q_r;
2107 static PyObject *__pyx_n_s_q_u;
2108 static PyObject *__pyx_n_s_q_vals;
2109 static PyObject *__pyx_n_s_q_x;
2110 static PyObject *__pyx_n_s_range;
2111 static PyObject *__pyx_n_s_rho;
2112 static PyObject *__pyx_n_s_rho2;
2113 static PyObject *__pyx_n_s_rhom;
2114 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
2115 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
2116 static PyObject *__pyx_n_s_rowptr;
2117 static PyObject *__pyx_n_s_sBar;
2118 static PyObject *__pyx_n_s_setElementBoundariesArray;
2119 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
2120 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
2121 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
2122 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
2123 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
2124 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
2125 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
2126 static PyObject *__pyx_n_s_shape;
2127 static PyObject *__pyx_n_s_sqrt_sBar;
2128 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
2129 static PyObject *__pyx_n_s_sum;
2130 static PyObject *__pyx_n_s_t;
2131 static PyObject *__pyx_n_s_tForReversal;
2132 static PyObject *__pyx_n_s_test;
2133 static PyObject *__pyx_n_s_thetaR;
2134 static PyObject *__pyx_n_s_thetaS;
2135 static PyObject *__pyx_n_s_thetaSR;
2136 static PyObject *__pyx_n_s_thetaW;
2137 static PyObject *__pyx_n_s_thisElementIsUpwind;
2138 static PyObject *__pyx_n_s_transient;
2139 static PyObject *__pyx_n_s_u_dof;
2140 static PyObject *__pyx_n_s_u_eN;
2141 static PyObject *__pyx_n_s_u_j;
2142 static PyObject *__pyx_n_s_u_l2g;
2143 static PyObject *__pyx_n_s_u_neig;
2144 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
2145 static PyObject *__pyx_n_s_updateMass_weakAvg;
2146 static PyObject *__pyx_n_s_upwindFlag;
2147 static PyObject *__pyx_n_s_v;
2148 static PyObject *__pyx_n_s_vBar;
2149 static PyObject *__pyx_n_s_vBar2;
2150 static PyObject *__pyx_n_s_vol;
2151 static PyObject *__pyx_n_s_volFactor;
2152 static PyObject *__pyx_n_s_vol_e;
2153 static PyObject *__pyx_n_s_volume;
2154 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
2155 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
2156 static PyObject *__pyx_n_s_w;
2157 static PyObject *__pyx_n_s_weak_residual;
2158 static PyObject *__pyx_n_s_weight;
2159 static PyObject *__pyx_n_s_x;
2160 static PyObject *__pyx_n_s_xc;
2161 static PyObject *__pyx_n_s_yc;
2162 static PyObject *__pyx_n_s_zVelocity;
2163 static PyObject *__pyx_n_s_zeros;
2164 static PyObject *__pyx_n_s_zvelocity;
2165 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
2166 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
2167 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2168 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2169 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2170 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2171 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2172 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2173 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2174 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2175 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2176 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2177 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2178 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2179 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
2180 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
2181 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
2182 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
2183 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
2184 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
2185 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
2186 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2187 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2188 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2189 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2190 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2191 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2192 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2193 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2194 static PyObject *__pyx_float_0_0;
2195 static PyObject *__pyx_float_0_5;
2196 static PyObject *__pyx_float_2_0;
2197 static PyObject *__pyx_float_1_0eneg_20;
2198 static PyObject *__pyx_slice_;
2199 static PyObject *__pyx_tuple__2;
2200 static PyObject *__pyx_tuple__3;
2201 static PyObject *__pyx_tuple__4;
2202 static PyObject *__pyx_tuple__6;
2203 static PyObject *__pyx_tuple__8;
2204 static PyObject *__pyx_tuple__10;
2205 static PyObject *__pyx_tuple__12;
2206 static PyObject *__pyx_tuple__14;
2207 static PyObject *__pyx_tuple__16;
2208 static PyObject *__pyx_tuple__18;
2209 static PyObject *__pyx_tuple__20;
2210 static PyObject *__pyx_tuple__22;
2211 static PyObject *__pyx_tuple__24;
2212 static PyObject *__pyx_tuple__26;
2213 static PyObject *__pyx_tuple__28;
2214 static PyObject *__pyx_tuple__30;
2215 static PyObject *__pyx_tuple__32;
2216 static PyObject *__pyx_tuple__34;
2217 static PyObject *__pyx_tuple__36;
2218 static PyObject *__pyx_tuple__38;
2219 static PyObject *__pyx_tuple__40;
2220 static PyObject *__pyx_tuple__42;
2221 static PyObject *__pyx_tuple__44;
2222 static PyObject *__pyx_tuple__46;
2223 static PyObject *__pyx_tuple__48;
2224 static PyObject *__pyx_tuple__50;
2225 static PyObject *__pyx_tuple__52;
2226 static PyObject *__pyx_tuple__54;
2227 static PyObject *__pyx_tuple__56;
2228 static PyObject *__pyx_tuple__58;
2229 static PyObject *__pyx_tuple__60;
2230 static PyObject *__pyx_codeobj__5;
2231 static PyObject *__pyx_codeobj__7;
2232 static PyObject *__pyx_codeobj__9;
2233 static PyObject *__pyx_codeobj__11;
2234 static PyObject *__pyx_codeobj__13;
2235 static PyObject *__pyx_codeobj__15;
2236 static PyObject *__pyx_codeobj__17;
2237 static PyObject *__pyx_codeobj__19;
2238 static PyObject *__pyx_codeobj__21;
2239 static PyObject *__pyx_codeobj__23;
2240 static PyObject *__pyx_codeobj__25;
2241 static PyObject *__pyx_codeobj__27;
2242 static PyObject *__pyx_codeobj__29;
2243 static PyObject *__pyx_codeobj__31;
2244 static PyObject *__pyx_codeobj__33;
2245 static PyObject *__pyx_codeobj__35;
2246 static PyObject *__pyx_codeobj__37;
2247 static PyObject *__pyx_codeobj__39;
2248 static PyObject *__pyx_codeobj__41;
2249 static PyObject *__pyx_codeobj__43;
2250 static PyObject *__pyx_codeobj__45;
2251 static PyObject *__pyx_codeobj__47;
2252 static PyObject *__pyx_codeobj__49;
2253 static PyObject *__pyx_codeobj__51;
2254 static PyObject *__pyx_codeobj__53;
2255 static PyObject *__pyx_codeobj__55;
2256 static PyObject *__pyx_codeobj__57;
2257 static PyObject *__pyx_codeobj__59;
2258 static PyObject *__pyx_codeobj__61;
2259 /* Late includes */
2260 
2261 /* "subsurfaceTransportFunctions.pyx":11
2262  * double sin(double x)
2263  * double M_PI
2264  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
2265  * cdef inline double double_min(double a, double b): return a if a <= b else b
2266  *
2267  */
2268 
2269 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
2270  double __pyx_r;
2271  __Pyx_RefNannyDeclarations
2272  double __pyx_t_1;
2273  __Pyx_RefNannySetupContext("double_max", 0);
2274  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
2275  __pyx_t_1 = __pyx_v_a;
2276  } else {
2277  __pyx_t_1 = __pyx_v_b;
2278  }
2279  __pyx_r = __pyx_t_1;
2280  goto __pyx_L0;
2281 
2282  /* function exit code */
2283  __pyx_L0:;
2284  __Pyx_RefNannyFinishContext();
2285  return __pyx_r;
2286 }
2287 
2288 /* "subsurfaceTransportFunctions.pyx":12
2289  * double M_PI
2290  * cdef inline double double_max(double a, double b): return a if a >= b else b
2291  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
2292  *
2293  * ctypedef numpy.double_t DTYPE_t
2294  */
2295 
2296 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
2297  double __pyx_r;
2298  __Pyx_RefNannyDeclarations
2299  double __pyx_t_1;
2300  __Pyx_RefNannySetupContext("double_min", 0);
2301  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
2302  __pyx_t_1 = __pyx_v_a;
2303  } else {
2304  __pyx_t_1 = __pyx_v_b;
2305  }
2306  __pyx_r = __pyx_t_1;
2307  goto __pyx_L0;
2308 
2309  /* function exit code */
2310  __pyx_L0:;
2311  __Pyx_RefNannyFinishContext();
2312  return __pyx_r;
2313 }
2314 
2315 /* "subsurfaceTransportFunctions.pyx":18
2316  * ctypedef int ITYPE_t
2317  *
2318  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2319  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2320  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2321  */
2322 
2323 /* Python wrapper */
2324 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2325 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
2326 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2327  int __pyx_v_nExteriorElementBoundaries_global;
2328  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2329  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2330  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2331  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
2332  int __pyx_lineno = 0;
2333  const char *__pyx_filename = NULL;
2334  int __pyx_clineno = 0;
2335  PyObject *__pyx_r = 0;
2336  __Pyx_RefNannyDeclarations
2337  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
2338  {
2339  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
2340  PyObject* values[5] = {0,0,0,0,0};
2341  if (unlikely(__pyx_kwds)) {
2342  Py_ssize_t kw_args;
2343  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2344  switch (pos_args) {
2345  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2346  CYTHON_FALLTHROUGH;
2347  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2348  CYTHON_FALLTHROUGH;
2349  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2350  CYTHON_FALLTHROUGH;
2351  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2352  CYTHON_FALLTHROUGH;
2353  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2354  CYTHON_FALLTHROUGH;
2355  case 0: break;
2356  default: goto __pyx_L5_argtuple_error;
2357  }
2358  kw_args = PyDict_Size(__pyx_kwds);
2359  switch (pos_args) {
2360  case 0:
2361  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2362  else goto __pyx_L5_argtuple_error;
2363  CYTHON_FALLTHROUGH;
2364  case 1:
2365  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2366  else {
2367  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); __PYX_ERR(0, 18, __pyx_L3_error)
2368  }
2369  CYTHON_FALLTHROUGH;
2370  case 2:
2371  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2372  else {
2373  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); __PYX_ERR(0, 18, __pyx_L3_error)
2374  }
2375  CYTHON_FALLTHROUGH;
2376  case 3:
2377  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2378  else {
2379  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); __PYX_ERR(0, 18, __pyx_L3_error)
2380  }
2381  CYTHON_FALLTHROUGH;
2382  case 4:
2383  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
2384  else {
2385  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); __PYX_ERR(0, 18, __pyx_L3_error)
2386  }
2387  }
2388  if (unlikely(kw_args > 0)) {
2389  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
2390  }
2391  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2392  goto __pyx_L5_argtuple_error;
2393  } else {
2394  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2395  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2396  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2397  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2398  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2399  }
2400  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
2401  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
2402  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
2403  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
2404  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
2405  }
2406  goto __pyx_L4_argument_unpacking_done;
2407  __pyx_L5_argtuple_error:;
2408  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
2409  __pyx_L3_error:;
2410  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2411  __Pyx_RefNannyFinishContext();
2412  return NULL;
2413  __pyx_L4_argument_unpacking_done:;
2414  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
2415  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
2416  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
2417  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
2418  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
2419 
2420  /* function exit code */
2421  goto __pyx_L0;
2422  __pyx_L1_error:;
2423  __pyx_r = NULL;
2424  __pyx_L0:;
2425  __Pyx_RefNannyFinishContext();
2426  return __pyx_r;
2427 }
2428 
2429 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
2430  int __pyx_v_ebNE;
2431  int __pyx_v_ebN;
2432  int __pyx_v_eN;
2433  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2434  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2435  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2436  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2437  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
2438  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
2439  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
2440  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2441  PyObject *__pyx_r = NULL;
2442  __Pyx_RefNannyDeclarations
2443  int __pyx_t_1;
2444  int __pyx_t_2;
2445  int __pyx_t_3;
2446  Py_ssize_t __pyx_t_4;
2447  int __pyx_t_5;
2448  Py_ssize_t __pyx_t_6;
2449  int __pyx_lineno = 0;
2450  const char *__pyx_filename = NULL;
2451  int __pyx_clineno = 0;
2452  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
2453  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
2454  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
2455  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
2456  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
2457  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2458  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2459  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2460  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2461  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2462  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2463  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2464  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2465  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
2466  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
2467  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
2468  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2469  {
2470  __Pyx_BufFmt_StackElem __pyx_stack[1];
2471  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2472  }
2473  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
2474  {
2475  __Pyx_BufFmt_StackElem __pyx_stack[1];
2476  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2477  }
2478  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2479  {
2480  __Pyx_BufFmt_StackElem __pyx_stack[1];
2481  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2482  }
2483  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2484  {
2485  __Pyx_BufFmt_StackElem __pyx_stack[1];
2486  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2487  }
2488  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
2489 
2490  /* "subsurfaceTransportFunctions.pyx":24
2491  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
2492  * cdef int ebNE,ebN,eN
2493  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
2494  * ebN = exteriorElementBoundariesArray[ebNE]
2495  * eN = elementBoundaryElementsArray[ebN,0]
2496  */
2497  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
2498  __pyx_t_2 = __pyx_t_1;
2499  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2500  __pyx_v_ebNE = __pyx_t_3;
2501 
2502  /* "subsurfaceTransportFunctions.pyx":25
2503  * cdef int ebNE,ebN,eN
2504  * for ebNE in range(nExteriorElementBoundaries_global):
2505  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
2506  * eN = elementBoundaryElementsArray[ebN,0]
2507  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2508  */
2509  __pyx_t_4 = __pyx_v_ebNE;
2510  __pyx_t_5 = -1;
2511  if (__pyx_t_4 < 0) {
2512  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
2513  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2514  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_5 = 0;
2515  if (unlikely(__pyx_t_5 != -1)) {
2516  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2517  __PYX_ERR(0, 25, __pyx_L1_error)
2518  }
2519  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
2520 
2521  /* "subsurfaceTransportFunctions.pyx":26
2522  * for ebNE in range(nExteriorElementBoundaries_global):
2523  * ebN = exteriorElementBoundariesArray[ebNE]
2524  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2525  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2526  *
2527  */
2528  __pyx_t_4 = __pyx_v_ebN;
2529  __pyx_t_6 = 0;
2530  __pyx_t_5 = -1;
2531  if (__pyx_t_4 < 0) {
2532  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2533  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2534  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2535  if (__pyx_t_6 < 0) {
2536  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2537  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 1;
2538  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2539  if (unlikely(__pyx_t_5 != -1)) {
2540  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2541  __PYX_ERR(0, 26, __pyx_L1_error)
2542  }
2543  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2544 
2545  /* "subsurfaceTransportFunctions.pyx":27
2546  * ebN = exteriorElementBoundariesArray[ebNE]
2547  * eN = elementBoundaryElementsArray[ebN,0]
2548  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2549  *
2550  * def setElementBoundariesArray(int nElementBoundaries_global,
2551  */
2552  __pyx_t_6 = __pyx_v_eN;
2553  __pyx_t_5 = -1;
2554  if (__pyx_t_6 < 0) {
2555  __pyx_t_6 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2556  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2557  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2558  if (unlikely(__pyx_t_5 != -1)) {
2559  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2560  __PYX_ERR(0, 27, __pyx_L1_error)
2561  }
2562  __pyx_t_4 = __pyx_v_ebNE;
2563  __pyx_t_5 = -1;
2564  if (__pyx_t_4 < 0) {
2565  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
2566  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2567  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2568  if (unlikely(__pyx_t_5 != -1)) {
2569  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2570  __PYX_ERR(0, 27, __pyx_L1_error)
2571  }
2572  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2573  }
2574 
2575  /* "subsurfaceTransportFunctions.pyx":18
2576  * ctypedef int ITYPE_t
2577  *
2578  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2579  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2580  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2581  */
2582 
2583  /* function exit code */
2584  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2585  goto __pyx_L0;
2586  __pyx_L1_error:;
2587  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2588  __Pyx_PyThreadState_declare
2589  __Pyx_PyThreadState_assign
2590  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2591  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2592  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2593  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2594  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2595  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2596  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2597  __pyx_r = NULL;
2598  goto __pyx_L2;
2599  __pyx_L0:;
2600  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2601  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2602  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2603  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2604  __pyx_L2:;
2605  __Pyx_XGIVEREF(__pyx_r);
2606  __Pyx_RefNannyFinishContext();
2607  return __pyx_r;
2608 }
2609 
2610 /* "subsurfaceTransportFunctions.pyx":29
2611  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2612  *
2613  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2614  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2615  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2616  */
2617 
2618 /* Python wrapper */
2619 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2620 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2621 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2622  int __pyx_v_nElementBoundaries_global;
2623  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2624  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2625  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2626  int __pyx_lineno = 0;
2627  const char *__pyx_filename = NULL;
2628  int __pyx_clineno = 0;
2629  PyObject *__pyx_r = 0;
2630  __Pyx_RefNannyDeclarations
2631  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2632  {
2633  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2634  PyObject* values[4] = {0,0,0,0};
2635  if (unlikely(__pyx_kwds)) {
2636  Py_ssize_t kw_args;
2637  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2638  switch (pos_args) {
2639  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2640  CYTHON_FALLTHROUGH;
2641  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2642  CYTHON_FALLTHROUGH;
2643  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2644  CYTHON_FALLTHROUGH;
2645  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2646  CYTHON_FALLTHROUGH;
2647  case 0: break;
2648  default: goto __pyx_L5_argtuple_error;
2649  }
2650  kw_args = PyDict_Size(__pyx_kwds);
2651  switch (pos_args) {
2652  case 0:
2653  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2654  else goto __pyx_L5_argtuple_error;
2655  CYTHON_FALLTHROUGH;
2656  case 1:
2657  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2658  else {
2659  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
2660  }
2661  CYTHON_FALLTHROUGH;
2662  case 2:
2663  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2664  else {
2665  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error)
2666  }
2667  CYTHON_FALLTHROUGH;
2668  case 3:
2669  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2670  else {
2671  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error)
2672  }
2673  }
2674  if (unlikely(kw_args > 0)) {
2675  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
2676  }
2677  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2678  goto __pyx_L5_argtuple_error;
2679  } else {
2680  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2681  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2682  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2683  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2684  }
2685  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2686  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2687  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2688  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2689  }
2690  goto __pyx_L4_argument_unpacking_done;
2691  __pyx_L5_argtuple_error:;
2692  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
2693  __pyx_L3_error:;
2694  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2695  __Pyx_RefNannyFinishContext();
2696  return NULL;
2697  __pyx_L4_argument_unpacking_done:;
2698  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
2699  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
2700  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
2701  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2702 
2703  /* function exit code */
2704  goto __pyx_L0;
2705  __pyx_L1_error:;
2706  __pyx_r = NULL;
2707  __pyx_L0:;
2708  __Pyx_RefNannyFinishContext();
2709  return __pyx_r;
2710 }
2711 
2712 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2713  int __pyx_v_ebN;
2714  int __pyx_v_eN_left;
2715  int __pyx_v_eN_right;
2716  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2717  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2718  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2719  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2720  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2721  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2722  PyObject *__pyx_r = NULL;
2723  __Pyx_RefNannyDeclarations
2724  int __pyx_t_1;
2725  int __pyx_t_2;
2726  int __pyx_t_3;
2727  Py_ssize_t __pyx_t_4;
2728  Py_ssize_t __pyx_t_5;
2729  int __pyx_t_6;
2730  Py_ssize_t __pyx_t_7;
2731  int __pyx_t_8;
2732  int __pyx_lineno = 0;
2733  const char *__pyx_filename = NULL;
2734  int __pyx_clineno = 0;
2735  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2736  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2737  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2738  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2739  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2740  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2741  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2742  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2743  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2744  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2745  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2746  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2747  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2748  {
2749  __Pyx_BufFmt_StackElem __pyx_stack[1];
2750  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2751  }
2752  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2753  {
2754  __Pyx_BufFmt_StackElem __pyx_stack[1];
2755  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2756  }
2757  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2758  {
2759  __Pyx_BufFmt_StackElem __pyx_stack[1];
2760  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2761  }
2762  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2763 
2764  /* "subsurfaceTransportFunctions.pyx":34
2765  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2766  * cdef int ebN,eN_left,eN_right
2767  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2768  * eN_left = elementBoundaryElementsArray[ebN,0]
2769  * eN_right= elementBoundaryElementsArray[ebN,1]
2770  */
2771  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2772  __pyx_t_2 = __pyx_t_1;
2773  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2774  __pyx_v_ebN = __pyx_t_3;
2775 
2776  /* "subsurfaceTransportFunctions.pyx":35
2777  * cdef int ebN,eN_left,eN_right
2778  * for ebN in range(nElementBoundaries_global):
2779  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2780  * eN_right= elementBoundaryElementsArray[ebN,1]
2781  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2782  */
2783  __pyx_t_4 = __pyx_v_ebN;
2784  __pyx_t_5 = 0;
2785  __pyx_t_6 = -1;
2786  if (__pyx_t_4 < 0) {
2787  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2788  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2789  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2790  if (__pyx_t_5 < 0) {
2791  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2792  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2793  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2794  if (unlikely(__pyx_t_6 != -1)) {
2795  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2796  __PYX_ERR(0, 35, __pyx_L1_error)
2797  }
2798  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2799 
2800  /* "subsurfaceTransportFunctions.pyx":36
2801  * for ebN in range(nElementBoundaries_global):
2802  * eN_left = elementBoundaryElementsArray[ebN,0]
2803  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2804  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2805  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2806  */
2807  __pyx_t_5 = __pyx_v_ebN;
2808  __pyx_t_4 = 1;
2809  __pyx_t_6 = -1;
2810  if (__pyx_t_5 < 0) {
2811  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2812  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2813  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2814  if (__pyx_t_4 < 0) {
2815  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2816  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
2817  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2818  if (unlikely(__pyx_t_6 != -1)) {
2819  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2820  __PYX_ERR(0, 36, __pyx_L1_error)
2821  }
2822  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2823 
2824  /* "subsurfaceTransportFunctions.pyx":37
2825  * eN_left = elementBoundaryElementsArray[ebN,0]
2826  * eN_right= elementBoundaryElementsArray[ebN,1]
2827  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2828  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2829  * if eN_right >= 0:
2830  */
2831  __pyx_t_4 = __pyx_v_eN_left;
2832  __pyx_t_6 = -1;
2833  if (__pyx_t_4 < 0) {
2834  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2835  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2836  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2837  if (unlikely(__pyx_t_6 != -1)) {
2838  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2839  __PYX_ERR(0, 37, __pyx_L1_error)
2840  }
2841  __pyx_t_5 = __pyx_v_ebN;
2842  __pyx_t_7 = 0;
2843  __pyx_t_6 = -1;
2844  if (__pyx_t_5 < 0) {
2845  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2846  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2847  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2848  if (__pyx_t_7 < 0) {
2849  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2850  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 1;
2851  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2852  if (unlikely(__pyx_t_6 != -1)) {
2853  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2854  __PYX_ERR(0, 37, __pyx_L1_error)
2855  }
2856  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2857 
2858  /* "subsurfaceTransportFunctions.pyx":38
2859  * eN_right= elementBoundaryElementsArray[ebN,1]
2860  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2861  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2862  * if eN_right >= 0:
2863  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2864  */
2865  __pyx_t_4 = __pyx_v_eN_left;
2866  __pyx_t_6 = -1;
2867  if (__pyx_t_4 < 0) {
2868  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2869  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2870  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2871  if (unlikely(__pyx_t_6 != -1)) {
2872  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2873  __PYX_ERR(0, 38, __pyx_L1_error)
2874  }
2875  __pyx_t_7 = __pyx_v_ebN;
2876  __pyx_t_5 = 1;
2877  __pyx_t_6 = -1;
2878  if (__pyx_t_7 < 0) {
2879  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2880  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
2881  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2882  if (__pyx_t_5 < 0) {
2883  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2884  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2885  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2886  if (unlikely(__pyx_t_6 != -1)) {
2887  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2888  __PYX_ERR(0, 38, __pyx_L1_error)
2889  }
2890  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2891 
2892  /* "subsurfaceTransportFunctions.pyx":39
2893  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2894  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2895  * if eN_right >= 0: # <<<<<<<<<<<<<<
2896  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2897  *
2898  */
2899  __pyx_t_8 = ((__pyx_v_eN_right >= 0) != 0);
2900  if (__pyx_t_8) {
2901 
2902  /* "subsurfaceTransportFunctions.pyx":40
2903  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2904  * if eN_right >= 0:
2905  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2906  *
2907  * ###
2908  */
2909  __pyx_t_4 = __pyx_v_eN_right;
2910  __pyx_t_6 = -1;
2911  if (__pyx_t_4 < 0) {
2912  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2913  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2914  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2915  if (unlikely(__pyx_t_6 != -1)) {
2916  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2917  __PYX_ERR(0, 40, __pyx_L1_error)
2918  }
2919  __pyx_t_5 = __pyx_v_ebN;
2920  __pyx_t_7 = 1;
2921  __pyx_t_6 = -1;
2922  if (__pyx_t_5 < 0) {
2923  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2924  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2925  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2926  if (__pyx_t_7 < 0) {
2927  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2928  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 1;
2929  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2930  if (unlikely(__pyx_t_6 != -1)) {
2931  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2932  __PYX_ERR(0, 40, __pyx_L1_error)
2933  }
2934  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2935 
2936  /* "subsurfaceTransportFunctions.pyx":39
2937  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2938  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2939  * if eN_right >= 0: # <<<<<<<<<<<<<<
2940  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2941  *
2942  */
2943  }
2944  }
2945 
2946  /* "subsurfaceTransportFunctions.pyx":29
2947  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2948  *
2949  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2950  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2951  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2952  */
2953 
2954  /* function exit code */
2955  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2956  goto __pyx_L0;
2957  __pyx_L1_error:;
2958  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2959  __Pyx_PyThreadState_declare
2960  __Pyx_PyThreadState_assign
2961  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2962  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2963  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2964  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2965  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2966  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2967  __pyx_r = NULL;
2968  goto __pyx_L2;
2969  __pyx_L0:;
2970  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2971  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2972  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2973  __pyx_L2:;
2974  __Pyx_XGIVEREF(__pyx_r);
2975  __Pyx_RefNannyFinishContext();
2976  return __pyx_r;
2977 }
2978 
2979 /* "subsurfaceTransportFunctions.pyx":43
2980  *
2981  * ###
2982  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2983  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2984  * dict material_functions):
2985  */
2986 
2987 /* Python wrapper */
2988 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2989 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
2990 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
2991 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2992  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2993  PyArrayObject *__pyx_v_q_vals = 0;
2994  PyObject *__pyx_v_material_functions = 0;
2995  int __pyx_lineno = 0;
2996  const char *__pyx_filename = NULL;
2997  int __pyx_clineno = 0;
2998  PyObject *__pyx_r = 0;
2999  __Pyx_RefNannyDeclarations
3000  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
3001  {
3002  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3003  PyObject* values[3] = {0,0,0};
3004  if (unlikely(__pyx_kwds)) {
3005  Py_ssize_t kw_args;
3006  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3007  switch (pos_args) {
3008  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3009  CYTHON_FALLTHROUGH;
3010  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3011  CYTHON_FALLTHROUGH;
3012  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3013  CYTHON_FALLTHROUGH;
3014  case 0: break;
3015  default: goto __pyx_L5_argtuple_error;
3016  }
3017  kw_args = PyDict_Size(__pyx_kwds);
3018  switch (pos_args) {
3019  case 0:
3020  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3021  else goto __pyx_L5_argtuple_error;
3022  CYTHON_FALLTHROUGH;
3023  case 1:
3024  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3025  else {
3026  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 43, __pyx_L3_error)
3027  }
3028  CYTHON_FALLTHROUGH;
3029  case 2:
3030  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3031  else {
3032  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 43, __pyx_L3_error)
3033  }
3034  }
3035  if (unlikely(kw_args > 0)) {
3036  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
3037  }
3038  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3039  goto __pyx_L5_argtuple_error;
3040  } else {
3041  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3042  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3043  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3044  }
3045  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3046  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3047  __pyx_v_material_functions = ((PyObject*)values[2]);
3048  }
3049  goto __pyx_L4_argument_unpacking_done;
3050  __pyx_L5_argtuple_error:;
3051  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
3052  __pyx_L3_error:;
3053  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3054  __Pyx_RefNannyFinishContext();
3055  return NULL;
3056  __pyx_L4_argument_unpacking_done:;
3057  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
3058  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
3059  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
3060  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3061 
3062  /* function exit code */
3063  goto __pyx_L0;
3064  __pyx_L1_error:;
3065  __pyx_r = NULL;
3066  __pyx_L0:;
3067  __Pyx_RefNannyFinishContext();
3068  return __pyx_r;
3069 }
3070 
3071 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3072  int __pyx_v_eN;
3073  int __pyx_v_k;
3074  int __pyx_v_material;
3075  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3076  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3077  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3078  __Pyx_Buffer __pyx_pybuffer_q_vals;
3079  PyObject *__pyx_r = NULL;
3080  __Pyx_RefNannyDeclarations
3081  npy_intp __pyx_t_1;
3082  npy_intp __pyx_t_2;
3083  int __pyx_t_3;
3084  Py_ssize_t __pyx_t_4;
3085  int __pyx_t_5;
3086  npy_intp __pyx_t_6;
3087  npy_intp __pyx_t_7;
3088  PyObject *__pyx_t_8 = NULL;
3089  PyObject *__pyx_t_9 = NULL;
3090  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_10;
3091  Py_ssize_t __pyx_t_11;
3092  int __pyx_t_12;
3093  int __pyx_lineno = 0;
3094  const char *__pyx_filename = NULL;
3095  int __pyx_clineno = 0;
3096  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
3097  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3098  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3099  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3100  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3101  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3102  __pyx_pybuffer_q_vals.refcount = 0;
3103  __pyx_pybuffernd_q_vals.data = NULL;
3104  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3105  {
3106  __Pyx_BufFmt_StackElem __pyx_stack[1];
3107  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3108  }
3109  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3110  {
3111  __Pyx_BufFmt_StackElem __pyx_stack[1];
3112  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3113  }
3114  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
3115 
3116  /* "subsurfaceTransportFunctions.pyx":51
3117  * """
3118  * cdef int eN,k,material
3119  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3120  * material = elementMaterialTypes[eN]
3121  * for k in range(q_vals.shape[1]):
3122  */
3123  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3124  __pyx_t_2 = __pyx_t_1;
3125  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3126  __pyx_v_eN = __pyx_t_3;
3127 
3128  /* "subsurfaceTransportFunctions.pyx":52
3129  * cdef int eN,k,material
3130  * for eN in range(q_vals.shape[0]):
3131  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3132  * for k in range(q_vals.shape[1]):
3133  * q_vals[eN,k] = material_functions[material]
3134  */
3135  __pyx_t_4 = __pyx_v_eN;
3136  __pyx_t_5 = -1;
3137  if (__pyx_t_4 < 0) {
3138  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3139  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3140  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3141  if (unlikely(__pyx_t_5 != -1)) {
3142  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3143  __PYX_ERR(0, 52, __pyx_L1_error)
3144  }
3145  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3146 
3147  /* "subsurfaceTransportFunctions.pyx":53
3148  * for eN in range(q_vals.shape[0]):
3149  * material = elementMaterialTypes[eN]
3150  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3151  * q_vals[eN,k] = material_functions[material]
3152  *
3153  */
3154  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3155  __pyx_t_7 = __pyx_t_6;
3156  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3157  __pyx_v_k = __pyx_t_5;
3158 
3159  /* "subsurfaceTransportFunctions.pyx":54
3160  * material = elementMaterialTypes[eN]
3161  * for k in range(q_vals.shape[1]):
3162  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
3163  *
3164  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
3165  */
3166  if (unlikely(__pyx_v_material_functions == Py_None)) {
3167  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3168  __PYX_ERR(0, 54, __pyx_L1_error)
3169  }
3170  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error)
3171  __Pyx_GOTREF(__pyx_t_8);
3172  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error)
3173  __Pyx_GOTREF(__pyx_t_9);
3174  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3175  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_10 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
3176  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3177  __pyx_t_4 = __pyx_v_eN;
3178  __pyx_t_11 = __pyx_v_k;
3179  __pyx_t_12 = -1;
3180  if (__pyx_t_4 < 0) {
3181  __pyx_t_4 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
3182  if (unlikely(__pyx_t_4 < 0)) __pyx_t_12 = 0;
3183  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_12 = 0;
3184  if (__pyx_t_11 < 0) {
3185  __pyx_t_11 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
3186  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
3187  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_12 = 1;
3188  if (unlikely(__pyx_t_12 != -1)) {
3189  __Pyx_RaiseBufferIndexError(__pyx_t_12);
3190  __PYX_ERR(0, 54, __pyx_L1_error)
3191  }
3192  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_10;
3193  }
3194  }
3195 
3196  /* "subsurfaceTransportFunctions.pyx":43
3197  *
3198  * ###
3199  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3200  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
3201  * dict material_functions):
3202  */
3203 
3204  /* function exit code */
3205  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3206  goto __pyx_L0;
3207  __pyx_L1_error:;
3208  __Pyx_XDECREF(__pyx_t_8);
3209  __Pyx_XDECREF(__pyx_t_9);
3210  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3211  __Pyx_PyThreadState_declare
3212  __Pyx_PyThreadState_assign
3213  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3214  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3215  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3216  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3217  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3218  __pyx_r = NULL;
3219  goto __pyx_L2;
3220  __pyx_L0:;
3221  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3222  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3223  __pyx_L2:;
3224  __Pyx_XGIVEREF(__pyx_r);
3225  __Pyx_RefNannyFinishContext();
3226  return __pyx_r;
3227 }
3228 
3229 /* "subsurfaceTransportFunctions.pyx":56
3230  * q_vals[eN,k] = material_functions[material]
3231  *
3232  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3233  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3234  * dict material_functions):
3235  */
3236 
3237 /* Python wrapper */
3238 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3239 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
3240 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
3241 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3242  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
3243  PyArrayObject *__pyx_v_q_vals = 0;
3244  PyObject *__pyx_v_material_functions = 0;
3245  int __pyx_lineno = 0;
3246  const char *__pyx_filename = NULL;
3247  int __pyx_clineno = 0;
3248  PyObject *__pyx_r = 0;
3249  __Pyx_RefNannyDeclarations
3250  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
3251  {
3252  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3253  PyObject* values[3] = {0,0,0};
3254  if (unlikely(__pyx_kwds)) {
3255  Py_ssize_t kw_args;
3256  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3257  switch (pos_args) {
3258  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3259  CYTHON_FALLTHROUGH;
3260  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3261  CYTHON_FALLTHROUGH;
3262  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3263  CYTHON_FALLTHROUGH;
3264  case 0: break;
3265  default: goto __pyx_L5_argtuple_error;
3266  }
3267  kw_args = PyDict_Size(__pyx_kwds);
3268  switch (pos_args) {
3269  case 0:
3270  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3271  else goto __pyx_L5_argtuple_error;
3272  CYTHON_FALLTHROUGH;
3273  case 1:
3274  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3275  else {
3276  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 56, __pyx_L3_error)
3277  }
3278  CYTHON_FALLTHROUGH;
3279  case 2:
3280  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3281  else {
3282  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 56, __pyx_L3_error)
3283  }
3284  }
3285  if (unlikely(kw_args > 0)) {
3286  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
3287  }
3288  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3289  goto __pyx_L5_argtuple_error;
3290  } else {
3291  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3292  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3293  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3294  }
3295  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3296  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3297  __pyx_v_material_functions = ((PyObject*)values[2]);
3298  }
3299  goto __pyx_L4_argument_unpacking_done;
3300  __pyx_L5_argtuple_error:;
3301  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
3302  __pyx_L3_error:;
3303  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3304  __Pyx_RefNannyFinishContext();
3305  return NULL;
3306  __pyx_L4_argument_unpacking_done:;
3307  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
3308  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 57, __pyx_L1_error)
3309  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 58, __pyx_L1_error)
3310  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3311 
3312  /* function exit code */
3313  goto __pyx_L0;
3314  __pyx_L1_error:;
3315  __pyx_r = NULL;
3316  __pyx_L0:;
3317  __Pyx_RefNannyFinishContext();
3318  return __pyx_r;
3319 }
3320 
3321 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3322  int __pyx_v_eN;
3323  int __pyx_v_k;
3324  int __pyx_v_material;
3325  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3326  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3327  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3328  __Pyx_Buffer __pyx_pybuffer_q_vals;
3329  PyObject *__pyx_r = NULL;
3330  __Pyx_RefNannyDeclarations
3331  npy_intp __pyx_t_1;
3332  npy_intp __pyx_t_2;
3333  int __pyx_t_3;
3334  Py_ssize_t __pyx_t_4;
3335  int __pyx_t_5;
3336  npy_intp __pyx_t_6;
3337  npy_intp __pyx_t_7;
3338  PyObject *__pyx_t_8 = NULL;
3339  PyObject *__pyx_t_9 = NULL;
3340  PyObject *__pyx_t_10 = NULL;
3341  PyObject *__pyx_t_11 = NULL;
3342  int __pyx_lineno = 0;
3343  const char *__pyx_filename = NULL;
3344  int __pyx_clineno = 0;
3345  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
3346  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3347  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3348  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3349  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3350  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3351  __pyx_pybuffer_q_vals.refcount = 0;
3352  __pyx_pybuffernd_q_vals.data = NULL;
3353  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3354  {
3355  __Pyx_BufFmt_StackElem __pyx_stack[1];
3356  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3357  }
3358  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3359  {
3360  __Pyx_BufFmt_StackElem __pyx_stack[1];
3361  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3362  }
3363  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
3364 
3365  /* "subsurfaceTransportFunctions.pyx":63
3366  * """
3367  * cdef int eN,k,material
3368  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3369  * material = elementMaterialTypes[eN]
3370  * for k in range(q_vals.shape[1]):
3371  */
3372  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3373  __pyx_t_2 = __pyx_t_1;
3374  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3375  __pyx_v_eN = __pyx_t_3;
3376 
3377  /* "subsurfaceTransportFunctions.pyx":64
3378  * cdef int eN,k,material
3379  * for eN in range(q_vals.shape[0]):
3380  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3381  * for k in range(q_vals.shape[1]):
3382  * q_vals[eN,k,:] = material_functions[material].flat
3383  */
3384  __pyx_t_4 = __pyx_v_eN;
3385  __pyx_t_5 = -1;
3386  if (__pyx_t_4 < 0) {
3387  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3388  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3389  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3390  if (unlikely(__pyx_t_5 != -1)) {
3391  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3392  __PYX_ERR(0, 64, __pyx_L1_error)
3393  }
3394  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3395 
3396  /* "subsurfaceTransportFunctions.pyx":65
3397  * for eN in range(q_vals.shape[0]):
3398  * material = elementMaterialTypes[eN]
3399  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3400  * q_vals[eN,k,:] = material_functions[material].flat
3401  *
3402  */
3403  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3404  __pyx_t_7 = __pyx_t_6;
3405  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3406  __pyx_v_k = __pyx_t_5;
3407 
3408  /* "subsurfaceTransportFunctions.pyx":66
3409  * material = elementMaterialTypes[eN]
3410  * for k in range(q_vals.shape[1]):
3411  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
3412  *
3413  *
3414  */
3415  if (unlikely(__pyx_v_material_functions == Py_None)) {
3416  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3417  __PYX_ERR(0, 66, __pyx_L1_error)
3418  }
3419  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3420  __Pyx_GOTREF(__pyx_t_8);
3421  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3422  __Pyx_GOTREF(__pyx_t_9);
3423  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3424  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3425  __Pyx_GOTREF(__pyx_t_8);
3426  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3427  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3428  __Pyx_GOTREF(__pyx_t_9);
3429  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 66, __pyx_L1_error)
3430  __Pyx_GOTREF(__pyx_t_10);
3431  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 66, __pyx_L1_error)
3432  __Pyx_GOTREF(__pyx_t_11);
3433  __Pyx_GIVEREF(__pyx_t_9);
3434  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
3435  __Pyx_GIVEREF(__pyx_t_10);
3436  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
3437  __Pyx_INCREF(__pyx_slice_);
3438  __Pyx_GIVEREF(__pyx_slice_);
3439  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_slice_);
3440  __pyx_t_9 = 0;
3441  __pyx_t_10 = 0;
3442  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_11, __pyx_t_8) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
3443  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3444  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3445  }
3446  }
3447 
3448  /* "subsurfaceTransportFunctions.pyx":56
3449  * q_vals[eN,k] = material_functions[material]
3450  *
3451  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3452  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3453  * dict material_functions):
3454  */
3455 
3456  /* function exit code */
3457  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3458  goto __pyx_L0;
3459  __pyx_L1_error:;
3460  __Pyx_XDECREF(__pyx_t_8);
3461  __Pyx_XDECREF(__pyx_t_9);
3462  __Pyx_XDECREF(__pyx_t_10);
3463  __Pyx_XDECREF(__pyx_t_11);
3464  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3465  __Pyx_PyThreadState_declare
3466  __Pyx_PyThreadState_assign
3467  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3468  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3469  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3470  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3471  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3472  __pyx_r = NULL;
3473  goto __pyx_L2;
3474  __pyx_L0:;
3475  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3476  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3477  __pyx_L2:;
3478  __Pyx_XGIVEREF(__pyx_r);
3479  __Pyx_RefNannyFinishContext();
3480  return __pyx_r;
3481 }
3482 
3483 /* "subsurfaceTransportFunctions.pyx":69
3484  *
3485  *
3486  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3487  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3488  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3489  */
3490 
3491 /* Python wrapper */
3492 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3493 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3494 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
3495 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3496  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3497  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3498  PyArrayObject *__pyx_v_ebq_vals = 0;
3499  PyObject *__pyx_v_material_functions = 0;
3500  int __pyx_lineno = 0;
3501  const char *__pyx_filename = NULL;
3502  int __pyx_clineno = 0;
3503  PyObject *__pyx_r = 0;
3504  __Pyx_RefNannyDeclarations
3505  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
3506  {
3507  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3508  PyObject* values[4] = {0,0,0,0};
3509  if (unlikely(__pyx_kwds)) {
3510  Py_ssize_t kw_args;
3511  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3512  switch (pos_args) {
3513  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3514  CYTHON_FALLTHROUGH;
3515  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3516  CYTHON_FALLTHROUGH;
3517  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3518  CYTHON_FALLTHROUGH;
3519  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3520  CYTHON_FALLTHROUGH;
3521  case 0: break;
3522  default: goto __pyx_L5_argtuple_error;
3523  }
3524  kw_args = PyDict_Size(__pyx_kwds);
3525  switch (pos_args) {
3526  case 0:
3527  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3528  else goto __pyx_L5_argtuple_error;
3529  CYTHON_FALLTHROUGH;
3530  case 1:
3531  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3532  else {
3533  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
3534  }
3535  CYTHON_FALLTHROUGH;
3536  case 2:
3537  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3538  else {
3539  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
3540  }
3541  CYTHON_FALLTHROUGH;
3542  case 3:
3543  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3544  else {
3545  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error)
3546  }
3547  }
3548  if (unlikely(kw_args > 0)) {
3549  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
3550  }
3551  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3552  goto __pyx_L5_argtuple_error;
3553  } else {
3554  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3555  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3556  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3557  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3558  }
3559  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3560  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3561  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
3562  __pyx_v_material_functions = ((PyObject*)values[3]);
3563  }
3564  goto __pyx_L4_argument_unpacking_done;
3565  __pyx_L5_argtuple_error:;
3566  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
3567  __pyx_L3_error:;
3568  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3569  __Pyx_RefNannyFinishContext();
3570  return NULL;
3571  __pyx_L4_argument_unpacking_done:;
3572  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
3573  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
3574  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
3575  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
3576  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3577 
3578  /* function exit code */
3579  goto __pyx_L0;
3580  __pyx_L1_error:;
3581  __pyx_r = NULL;
3582  __pyx_L0:;
3583  __Pyx_RefNannyFinishContext();
3584  return __pyx_r;
3585 }
3586 
3587 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3588  int __pyx_v_eN;
3589  int __pyx_v_ebN;
3590  int __pyx_v_ebN_local;
3591  int __pyx_v_k;
3592  int __pyx_v_material_left;
3593  int __pyx_v_material_right;
3594  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3595  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3596  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3597  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3598  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3599  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3600  PyObject *__pyx_r = NULL;
3601  __Pyx_RefNannyDeclarations
3602  npy_intp __pyx_t_1;
3603  npy_intp __pyx_t_2;
3604  int __pyx_t_3;
3605  npy_intp __pyx_t_4;
3606  npy_intp __pyx_t_5;
3607  int __pyx_t_6;
3608  Py_ssize_t __pyx_t_7;
3609  Py_ssize_t __pyx_t_8;
3610  int __pyx_t_9;
3611  npy_intp __pyx_t_10;
3612  npy_intp __pyx_t_11;
3613  PyObject *__pyx_t_12 = NULL;
3614  PyObject *__pyx_t_13 = NULL;
3615  PyObject *__pyx_t_14 = NULL;
3616  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
3617  Py_ssize_t __pyx_t_16;
3618  int __pyx_t_17;
3619  int __pyx_lineno = 0;
3620  const char *__pyx_filename = NULL;
3621  int __pyx_clineno = 0;
3622  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3623  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3624  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3625  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3626  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3627  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3628  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3629  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3630  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3631  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3632  __pyx_pybuffer_ebq_vals.refcount = 0;
3633  __pyx_pybuffernd_ebq_vals.data = NULL;
3634  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3635  {
3636  __Pyx_BufFmt_StackElem __pyx_stack[1];
3637  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3638  }
3639  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3640  {
3641  __Pyx_BufFmt_StackElem __pyx_stack[1];
3642  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3643  }
3644  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3645  {
3646  __Pyx_BufFmt_StackElem __pyx_stack[1];
3647  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3648  }
3649  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3650 
3651  /* "subsurfaceTransportFunctions.pyx":82
3652  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3653  *
3654  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3655  * for ebN_local in range(ebq_vals.shape[1]):
3656  * ebN = elementBoundariesArray[eN,ebN_local]
3657  */
3658  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3659  __pyx_t_2 = __pyx_t_1;
3660  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3661  __pyx_v_eN = __pyx_t_3;
3662 
3663  /* "subsurfaceTransportFunctions.pyx":83
3664  *
3665  * for eN in range(ebq_vals.shape[0]):
3666  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3667  * ebN = elementBoundariesArray[eN,ebN_local]
3668  * material_left = elementBoundaryTypes[ebN,0]
3669  */
3670  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
3671  __pyx_t_5 = __pyx_t_4;
3672  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3673  __pyx_v_ebN_local = __pyx_t_6;
3674 
3675  /* "subsurfaceTransportFunctions.pyx":84
3676  * for eN in range(ebq_vals.shape[0]):
3677  * for ebN_local in range(ebq_vals.shape[1]):
3678  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3679  * material_left = elementBoundaryTypes[ebN,0]
3680  * material_right= elementBoundaryTypes[ebN,1]
3681  */
3682  __pyx_t_7 = __pyx_v_eN;
3683  __pyx_t_8 = __pyx_v_ebN_local;
3684  __pyx_t_9 = -1;
3685  if (__pyx_t_7 < 0) {
3686  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3687  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3688  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
3689  if (__pyx_t_8 < 0) {
3690  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3691  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3692  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
3693  if (unlikely(__pyx_t_9 != -1)) {
3694  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3695  __PYX_ERR(0, 84, __pyx_L1_error)
3696  }
3697  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3698 
3699  /* "subsurfaceTransportFunctions.pyx":85
3700  * for ebN_local in range(ebq_vals.shape[1]):
3701  * ebN = elementBoundariesArray[eN,ebN_local]
3702  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3703  * material_right= elementBoundaryTypes[ebN,1]
3704  * for k in range(ebq_vals.shape[2]):
3705  */
3706  __pyx_t_8 = __pyx_v_ebN;
3707  __pyx_t_7 = 0;
3708  __pyx_t_9 = -1;
3709  if (__pyx_t_8 < 0) {
3710  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3711  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
3712  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3713  if (__pyx_t_7 < 0) {
3714  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3715  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
3716  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3717  if (unlikely(__pyx_t_9 != -1)) {
3718  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3719  __PYX_ERR(0, 85, __pyx_L1_error)
3720  }
3721  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3722 
3723  /* "subsurfaceTransportFunctions.pyx":86
3724  * ebN = elementBoundariesArray[eN,ebN_local]
3725  * material_left = elementBoundaryTypes[ebN,0]
3726  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3727  * for k in range(ebq_vals.shape[2]):
3728  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3729  */
3730  __pyx_t_7 = __pyx_v_ebN;
3731  __pyx_t_8 = 1;
3732  __pyx_t_9 = -1;
3733  if (__pyx_t_7 < 0) {
3734  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3735  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3736  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3737  if (__pyx_t_8 < 0) {
3738  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3739  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3740  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3741  if (unlikely(__pyx_t_9 != -1)) {
3742  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3743  __PYX_ERR(0, 86, __pyx_L1_error)
3744  }
3745  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3746 
3747  /* "subsurfaceTransportFunctions.pyx":87
3748  * material_left = elementBoundaryTypes[ebN,0]
3749  * material_right= elementBoundaryTypes[ebN,1]
3750  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3751  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3752  * material_functions[material_right])
3753  */
3754  __pyx_t_10 = (__pyx_v_ebq_vals->dimensions[2]);
3755  __pyx_t_11 = __pyx_t_10;
3756  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
3757  __pyx_v_k = __pyx_t_9;
3758 
3759  /* "subsurfaceTransportFunctions.pyx":88
3760  * material_right= elementBoundaryTypes[ebN,1]
3761  * for k in range(ebq_vals.shape[2]):
3762  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3763  * material_functions[material_right])
3764  *
3765  */
3766  if (unlikely(__pyx_v_material_functions == Py_None)) {
3767  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3768  __PYX_ERR(0, 88, __pyx_L1_error)
3769  }
3770  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
3771  __Pyx_GOTREF(__pyx_t_12);
3772  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error)
3773  __Pyx_GOTREF(__pyx_t_13);
3774  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3775 
3776  /* "subsurfaceTransportFunctions.pyx":89
3777  * for k in range(ebq_vals.shape[2]):
3778  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3779  * material_functions[material_right]) # <<<<<<<<<<<<<<
3780  *
3781  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3782  */
3783  if (unlikely(__pyx_v_material_functions == Py_None)) {
3784  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3785  __PYX_ERR(0, 89, __pyx_L1_error)
3786  }
3787  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L1_error)
3788  __Pyx_GOTREF(__pyx_t_12);
3789  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 89, __pyx_L1_error)
3790  __Pyx_GOTREF(__pyx_t_14);
3791  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3792 
3793  /* "subsurfaceTransportFunctions.pyx":88
3794  * material_right= elementBoundaryTypes[ebN,1]
3795  * for k in range(ebq_vals.shape[2]):
3796  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3797  * material_functions[material_right])
3798  *
3799  */
3800  __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
3801  __Pyx_GOTREF(__pyx_t_12);
3802  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3803  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3804  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L1_error)
3805  __Pyx_GOTREF(__pyx_t_14);
3806  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3807  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3808  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3809  __pyx_t_8 = __pyx_v_eN;
3810  __pyx_t_7 = __pyx_v_ebN_local;
3811  __pyx_t_16 = __pyx_v_k;
3812  __pyx_t_17 = -1;
3813  if (__pyx_t_8 < 0) {
3814  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3815  if (unlikely(__pyx_t_8 < 0)) __pyx_t_17 = 0;
3816  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_17 = 0;
3817  if (__pyx_t_7 < 0) {
3818  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3819  if (unlikely(__pyx_t_7 < 0)) __pyx_t_17 = 1;
3820  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_17 = 1;
3821  if (__pyx_t_16 < 0) {
3822  __pyx_t_16 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3823  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 2;
3824  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_17 = 2;
3825  if (unlikely(__pyx_t_17 != -1)) {
3826  __Pyx_RaiseBufferIndexError(__pyx_t_17);
3827  __PYX_ERR(0, 88, __pyx_L1_error)
3828  }
3829  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_15;
3830  }
3831  }
3832  }
3833 
3834  /* "subsurfaceTransportFunctions.pyx":69
3835  *
3836  *
3837  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3838  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3839  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3840  */
3841 
3842  /* function exit code */
3843  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3844  goto __pyx_L0;
3845  __pyx_L1_error:;
3846  __Pyx_XDECREF(__pyx_t_12);
3847  __Pyx_XDECREF(__pyx_t_13);
3848  __Pyx_XDECREF(__pyx_t_14);
3849  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3850  __Pyx_PyThreadState_declare
3851  __Pyx_PyThreadState_assign
3852  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3853  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3854  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3855  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3856  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3857  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3858  __pyx_r = NULL;
3859  goto __pyx_L2;
3860  __pyx_L0:;
3861  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3862  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3863  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3864  __pyx_L2:;
3865  __Pyx_XGIVEREF(__pyx_r);
3866  __Pyx_RefNannyFinishContext();
3867  return __pyx_r;
3868 }
3869 
3870 /* "subsurfaceTransportFunctions.pyx":91
3871  * material_functions[material_right])
3872  *
3873  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3874  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3875  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3876  */
3877 
3878 /* Python wrapper */
3879 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3880 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3881 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3882 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3883  int __pyx_v_nd;
3884  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3885  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3886  PyArrayObject *__pyx_v_ebq_vals = 0;
3887  PyObject *__pyx_v_material_functions = 0;
3888  int __pyx_lineno = 0;
3889  const char *__pyx_filename = NULL;
3890  int __pyx_clineno = 0;
3891  PyObject *__pyx_r = 0;
3892  __Pyx_RefNannyDeclarations
3893  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3894  {
3895  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3896  PyObject* values[5] = {0,0,0,0,0};
3897  if (unlikely(__pyx_kwds)) {
3898  Py_ssize_t kw_args;
3899  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3900  switch (pos_args) {
3901  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3902  CYTHON_FALLTHROUGH;
3903  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3904  CYTHON_FALLTHROUGH;
3905  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3906  CYTHON_FALLTHROUGH;
3907  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3908  CYTHON_FALLTHROUGH;
3909  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3910  CYTHON_FALLTHROUGH;
3911  case 0: break;
3912  default: goto __pyx_L5_argtuple_error;
3913  }
3914  kw_args = PyDict_Size(__pyx_kwds);
3915  switch (pos_args) {
3916  case 0:
3917  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3918  else goto __pyx_L5_argtuple_error;
3919  CYTHON_FALLTHROUGH;
3920  case 1:
3921  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3922  else {
3923  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 91, __pyx_L3_error)
3924  }
3925  CYTHON_FALLTHROUGH;
3926  case 2:
3927  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3928  else {
3929  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 91, __pyx_L3_error)
3930  }
3931  CYTHON_FALLTHROUGH;
3932  case 3:
3933  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3934  else {
3935  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 91, __pyx_L3_error)
3936  }
3937  CYTHON_FALLTHROUGH;
3938  case 4:
3939  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3940  else {
3941  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 91, __pyx_L3_error)
3942  }
3943  }
3944  if (unlikely(kw_args > 0)) {
3945  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
3946  }
3947  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3948  goto __pyx_L5_argtuple_error;
3949  } else {
3950  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3951  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3952  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3953  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3954  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3955  }
3956  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
3957  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
3958  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
3959  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
3960  __pyx_v_material_functions = ((PyObject*)values[4]);
3961  }
3962  goto __pyx_L4_argument_unpacking_done;
3963  __pyx_L5_argtuple_error:;
3964  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
3965  __pyx_L3_error:;
3966  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3967  __Pyx_RefNannyFinishContext();
3968  return NULL;
3969  __pyx_L4_argument_unpacking_done:;
3970  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 92, __pyx_L1_error)
3971  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 93, __pyx_L1_error)
3972  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 94, __pyx_L1_error)
3973  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 95, __pyx_L1_error)
3974  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3975 
3976  /* function exit code */
3977  goto __pyx_L0;
3978  __pyx_L1_error:;
3979  __pyx_r = NULL;
3980  __pyx_L0:;
3981  __Pyx_RefNannyFinishContext();
3982  return __pyx_r;
3983 }
3984 
3985 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3986  int __pyx_v_eN;
3987  int __pyx_v_ebN;
3988  int __pyx_v_ebN_local;
3989  int __pyx_v_k;
3990  int __pyx_v_material_left;
3991  int __pyx_v_material_right;
3992  int __pyx_v_I;
3993  int __pyx_v_J;
3994  double __pyx_v_numer;
3995  double __pyx_v_denom;
3996  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3997  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3998  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3999  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4000  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4001  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4002  PyObject *__pyx_r = NULL;
4003  __Pyx_RefNannyDeclarations
4004  npy_intp __pyx_t_1;
4005  npy_intp __pyx_t_2;
4006  int __pyx_t_3;
4007  npy_intp __pyx_t_4;
4008  npy_intp __pyx_t_5;
4009  int __pyx_t_6;
4010  Py_ssize_t __pyx_t_7;
4011  Py_ssize_t __pyx_t_8;
4012  int __pyx_t_9;
4013  npy_intp __pyx_t_10;
4014  npy_intp __pyx_t_11;
4015  int __pyx_t_12;
4016  int __pyx_t_13;
4017  int __pyx_t_14;
4018  int __pyx_t_15;
4019  int __pyx_t_16;
4020  int __pyx_t_17;
4021  PyObject *__pyx_t_18 = NULL;
4022  PyObject *__pyx_t_19 = NULL;
4023  PyObject *__pyx_t_20 = NULL;
4024  PyObject *__pyx_t_21 = NULL;
4025  PyObject *__pyx_t_22 = NULL;
4026  double __pyx_t_23;
4027  Py_ssize_t __pyx_t_24;
4028  Py_ssize_t __pyx_t_25;
4029  int __pyx_t_26;
4030  int __pyx_lineno = 0;
4031  const char *__pyx_filename = NULL;
4032  int __pyx_clineno = 0;
4033  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
4034  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4035  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4036  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4037  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4038  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4039  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4040  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4041  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4042  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
4043  __pyx_pybuffer_ebq_vals.refcount = 0;
4044  __pyx_pybuffernd_ebq_vals.data = NULL;
4045  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
4046  {
4047  __Pyx_BufFmt_StackElem __pyx_stack[1];
4048  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4049  }
4050  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4051  {
4052  __Pyx_BufFmt_StackElem __pyx_stack[1];
4053  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4054  }
4055  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4056  {
4057  __Pyx_BufFmt_StackElem __pyx_stack[1];
4058  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4059  }
4060  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
4061 
4062  /* "subsurfaceTransportFunctions.pyx":106
4063  * cdef double numer,denom
4064  *
4065  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
4066  * for ebN_local in range(ebq_vals.shape[1]):
4067  * ebN = elementBoundariesArray[eN,ebN_local]
4068  */
4069  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
4070  __pyx_t_2 = __pyx_t_1;
4071  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4072  __pyx_v_eN = __pyx_t_3;
4073 
4074  /* "subsurfaceTransportFunctions.pyx":107
4075  *
4076  * for eN in range(ebq_vals.shape[0]):
4077  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
4078  * ebN = elementBoundariesArray[eN,ebN_local]
4079  * material_left = elementBoundaryTypes[ebN,0]
4080  */
4081  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
4082  __pyx_t_5 = __pyx_t_4;
4083  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4084  __pyx_v_ebN_local = __pyx_t_6;
4085 
4086  /* "subsurfaceTransportFunctions.pyx":108
4087  * for eN in range(ebq_vals.shape[0]):
4088  * for ebN_local in range(ebq_vals.shape[1]):
4089  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
4090  * material_left = elementBoundaryTypes[ebN,0]
4091  * material_right= elementBoundaryTypes[ebN,1]
4092  */
4093  __pyx_t_7 = __pyx_v_eN;
4094  __pyx_t_8 = __pyx_v_ebN_local;
4095  __pyx_t_9 = -1;
4096  if (__pyx_t_7 < 0) {
4097  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
4098  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4099  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
4100  if (__pyx_t_8 < 0) {
4101  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
4102  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4103  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
4104  if (unlikely(__pyx_t_9 != -1)) {
4105  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4106  __PYX_ERR(0, 108, __pyx_L1_error)
4107  }
4108  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
4109 
4110  /* "subsurfaceTransportFunctions.pyx":109
4111  * for ebN_local in range(ebq_vals.shape[1]):
4112  * ebN = elementBoundariesArray[eN,ebN_local]
4113  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4114  * material_right= elementBoundaryTypes[ebN,1]
4115  * for k in range(ebq_vals.shape[2]):
4116  */
4117  __pyx_t_8 = __pyx_v_ebN;
4118  __pyx_t_7 = 0;
4119  __pyx_t_9 = -1;
4120  if (__pyx_t_8 < 0) {
4121  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4122  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
4123  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4124  if (__pyx_t_7 < 0) {
4125  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4126  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
4127  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4128  if (unlikely(__pyx_t_9 != -1)) {
4129  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4130  __PYX_ERR(0, 109, __pyx_L1_error)
4131  }
4132  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4133 
4134  /* "subsurfaceTransportFunctions.pyx":110
4135  * ebN = elementBoundariesArray[eN,ebN_local]
4136  * material_left = elementBoundaryTypes[ebN,0]
4137  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4138  * for k in range(ebq_vals.shape[2]):
4139  * for I in range(nd):
4140  */
4141  __pyx_t_7 = __pyx_v_ebN;
4142  __pyx_t_8 = 1;
4143  __pyx_t_9 = -1;
4144  if (__pyx_t_7 < 0) {
4145  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4146  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4147  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4148  if (__pyx_t_8 < 0) {
4149  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4150  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4151  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4152  if (unlikely(__pyx_t_9 != -1)) {
4153  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4154  __PYX_ERR(0, 110, __pyx_L1_error)
4155  }
4156  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4157 
4158  /* "subsurfaceTransportFunctions.pyx":111
4159  * material_left = elementBoundaryTypes[ebN,0]
4160  * material_right= elementBoundaryTypes[ebN,1]
4161  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
4162  * for I in range(nd):
4163  * for J in range(nd):
4164  */
4165  __pyx_t_10 = (__pyx_v_ebq_vals->dimensions[2]);
4166  __pyx_t_11 = __pyx_t_10;
4167  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
4168  __pyx_v_k = __pyx_t_9;
4169 
4170  /* "subsurfaceTransportFunctions.pyx":112
4171  * material_right= elementBoundaryTypes[ebN,1]
4172  * for k in range(ebq_vals.shape[2]):
4173  * for I in range(nd): # <<<<<<<<<<<<<<
4174  * for J in range(nd):
4175  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4176  */
4177  __pyx_t_12 = __pyx_v_nd;
4178  __pyx_t_13 = __pyx_t_12;
4179  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
4180  __pyx_v_I = __pyx_t_14;
4181 
4182  /* "subsurfaceTransportFunctions.pyx":113
4183  * for k in range(ebq_vals.shape[2]):
4184  * for I in range(nd):
4185  * for J in range(nd): # <<<<<<<<<<<<<<
4186  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4187  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4188  */
4189  __pyx_t_15 = __pyx_v_nd;
4190  __pyx_t_16 = __pyx_t_15;
4191  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
4192  __pyx_v_J = __pyx_t_17;
4193 
4194  /* "subsurfaceTransportFunctions.pyx":114
4195  * for I in range(nd):
4196  * for J in range(nd):
4197  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4198  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4199  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4200  */
4201  if (unlikely(__pyx_v_material_functions == Py_None)) {
4202  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4203  __PYX_ERR(0, 114, __pyx_L1_error)
4204  }
4205  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4206  __Pyx_GOTREF(__pyx_t_18);
4207  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
4208  __Pyx_GOTREF(__pyx_t_19);
4209  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4210  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4211  __Pyx_GOTREF(__pyx_t_18);
4212  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4213  __Pyx_GOTREF(__pyx_t_20);
4214  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
4215  __Pyx_GOTREF(__pyx_t_21);
4216  __Pyx_GIVEREF(__pyx_t_18);
4217  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
4218  __Pyx_GIVEREF(__pyx_t_20);
4219  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_20);
4220  __pyx_t_18 = 0;
4221  __pyx_t_20 = 0;
4222  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4223  __Pyx_GOTREF(__pyx_t_20);
4224  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4225  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4226  __pyx_t_21 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
4227  __Pyx_GOTREF(__pyx_t_21);
4228  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4229  if (unlikely(__pyx_v_material_functions == Py_None)) {
4230  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4231  __PYX_ERR(0, 114, __pyx_L1_error)
4232  }
4233  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4234  __Pyx_GOTREF(__pyx_t_20);
4235  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
4236  __Pyx_GOTREF(__pyx_t_19);
4237  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4238  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4239  __Pyx_GOTREF(__pyx_t_20);
4240  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4241  __Pyx_GOTREF(__pyx_t_18);
4242  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4243  __Pyx_GOTREF(__pyx_t_22);
4244  __Pyx_GIVEREF(__pyx_t_20);
4245  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_20);
4246  __Pyx_GIVEREF(__pyx_t_18);
4247  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_18);
4248  __pyx_t_20 = 0;
4249  __pyx_t_18 = 0;
4250  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4251  __Pyx_GOTREF(__pyx_t_18);
4252  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4253  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4254  __pyx_t_22 = PyNumber_Multiply(__pyx_t_21, __pyx_t_18); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4255  __Pyx_GOTREF(__pyx_t_22);
4256  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4257  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4258  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_22); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
4259  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4260  __pyx_v_numer = __pyx_t_23;
4261 
4262  /* "subsurfaceTransportFunctions.pyx":115
4263  * for J in range(nd):
4264  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4265  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4266  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4267  *
4268  */
4269  if (unlikely(__pyx_v_material_functions == Py_None)) {
4270  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4271  __PYX_ERR(0, 115, __pyx_L1_error)
4272  }
4273  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4274  __Pyx_GOTREF(__pyx_t_22);
4275  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
4276  __Pyx_GOTREF(__pyx_t_18);
4277  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4278  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4279  __Pyx_GOTREF(__pyx_t_22);
4280  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
4281  __Pyx_GOTREF(__pyx_t_21);
4282  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4283  __Pyx_GOTREF(__pyx_t_19);
4284  __Pyx_GIVEREF(__pyx_t_22);
4285  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_22);
4286  __Pyx_GIVEREF(__pyx_t_21);
4287  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
4288  __pyx_t_22 = 0;
4289  __pyx_t_21 = 0;
4290  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
4291  __Pyx_GOTREF(__pyx_t_21);
4292  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4293  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4294  if (unlikely(__pyx_v_material_functions == Py_None)) {
4295  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4296  __PYX_ERR(0, 115, __pyx_L1_error)
4297  }
4298  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4299  __Pyx_GOTREF(__pyx_t_19);
4300  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
4301  __Pyx_GOTREF(__pyx_t_18);
4302  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4303  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4304  __Pyx_GOTREF(__pyx_t_19);
4305  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4306  __Pyx_GOTREF(__pyx_t_22);
4307  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
4308  __Pyx_GOTREF(__pyx_t_20);
4309  __Pyx_GIVEREF(__pyx_t_19);
4310  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
4311  __Pyx_GIVEREF(__pyx_t_22);
4312  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_22);
4313  __pyx_t_19 = 0;
4314  __pyx_t_22 = 0;
4315  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4316  __Pyx_GOTREF(__pyx_t_22);
4317  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4318  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4319  __pyx_t_20 = PyNumber_Add(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
4320  __Pyx_GOTREF(__pyx_t_20);
4321  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4322  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4323  __pyx_t_22 = __Pyx_PyFloat_AddObjC(__pyx_t_20, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4324  __Pyx_GOTREF(__pyx_t_22);
4325  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4326  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_22); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
4327  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4328  __pyx_v_denom = __pyx_t_23;
4329 
4330  /* "subsurfaceTransportFunctions.pyx":116
4331  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4332  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4333  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4334  *
4335  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4336  */
4337  if (unlikely(__pyx_v_denom == 0)) {
4338  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4339  __PYX_ERR(0, 116, __pyx_L1_error)
4340  }
4341  __pyx_t_8 = __pyx_v_eN;
4342  __pyx_t_7 = __pyx_v_ebN_local;
4343  __pyx_t_24 = __pyx_v_k;
4344  __pyx_t_25 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4345  __pyx_t_26 = -1;
4346  if (__pyx_t_8 < 0) {
4347  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
4348  if (unlikely(__pyx_t_8 < 0)) __pyx_t_26 = 0;
4349  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_26 = 0;
4350  if (__pyx_t_7 < 0) {
4351  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
4352  if (unlikely(__pyx_t_7 < 0)) __pyx_t_26 = 1;
4353  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_26 = 1;
4354  if (__pyx_t_24 < 0) {
4355  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
4356  if (unlikely(__pyx_t_24 < 0)) __pyx_t_26 = 2;
4357  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_26 = 2;
4358  if (__pyx_t_25 < 0) {
4359  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
4360  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 3;
4361  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_26 = 3;
4362  if (unlikely(__pyx_t_26 != -1)) {
4363  __Pyx_RaiseBufferIndexError(__pyx_t_26);
4364  __PYX_ERR(0, 116, __pyx_L1_error)
4365  }
4366  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
4367  }
4368  }
4369  }
4370  }
4371  }
4372 
4373  /* "subsurfaceTransportFunctions.pyx":91
4374  * material_functions[material_right])
4375  *
4376  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4377  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4378  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4379  */
4380 
4381  /* function exit code */
4382  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4383  goto __pyx_L0;
4384  __pyx_L1_error:;
4385  __Pyx_XDECREF(__pyx_t_18);
4386  __Pyx_XDECREF(__pyx_t_19);
4387  __Pyx_XDECREF(__pyx_t_20);
4388  __Pyx_XDECREF(__pyx_t_21);
4389  __Pyx_XDECREF(__pyx_t_22);
4390  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4391  __Pyx_PyThreadState_declare
4392  __Pyx_PyThreadState_assign
4393  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4394  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4395  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4396  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4397  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4398  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4399  __pyx_r = NULL;
4400  goto __pyx_L2;
4401  __pyx_L0:;
4402  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4403  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4404  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4405  __pyx_L2:;
4406  __Pyx_XGIVEREF(__pyx_r);
4407  __Pyx_RefNannyFinishContext();
4408  return __pyx_r;
4409 }
4410 
4411 /* "subsurfaceTransportFunctions.pyx":118
4412  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4413  *
4414  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4415  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4416  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4417  */
4418 
4419 /* Python wrapper */
4420 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4421 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4422 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
4423 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4424  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4425  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4426  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4427  PyObject *__pyx_v_material_functions = 0;
4428  int __pyx_lineno = 0;
4429  const char *__pyx_filename = NULL;
4430  int __pyx_clineno = 0;
4431  PyObject *__pyx_r = 0;
4432  __Pyx_RefNannyDeclarations
4433  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
4434  {
4435  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4436  PyObject* values[4] = {0,0,0,0};
4437  if (unlikely(__pyx_kwds)) {
4438  Py_ssize_t kw_args;
4439  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4440  switch (pos_args) {
4441  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4442  CYTHON_FALLTHROUGH;
4443  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4444  CYTHON_FALLTHROUGH;
4445  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4446  CYTHON_FALLTHROUGH;
4447  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4448  CYTHON_FALLTHROUGH;
4449  case 0: break;
4450  default: goto __pyx_L5_argtuple_error;
4451  }
4452  kw_args = PyDict_Size(__pyx_kwds);
4453  switch (pos_args) {
4454  case 0:
4455  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4456  else goto __pyx_L5_argtuple_error;
4457  CYTHON_FALLTHROUGH;
4458  case 1:
4459  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4460  else {
4461  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 118, __pyx_L3_error)
4462  }
4463  CYTHON_FALLTHROUGH;
4464  case 2:
4465  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4466  else {
4467  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 118, __pyx_L3_error)
4468  }
4469  CYTHON_FALLTHROUGH;
4470  case 3:
4471  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4472  else {
4473  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 118, __pyx_L3_error)
4474  }
4475  }
4476  if (unlikely(kw_args > 0)) {
4477  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 118, __pyx_L3_error)
4478  }
4479  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4480  goto __pyx_L5_argtuple_error;
4481  } else {
4482  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4483  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4484  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4485  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4486  }
4487  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
4488  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
4489  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
4490  __pyx_v_material_functions = ((PyObject*)values[3]);
4491  }
4492  goto __pyx_L4_argument_unpacking_done;
4493  __pyx_L5_argtuple_error:;
4494  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 118, __pyx_L3_error)
4495  __pyx_L3_error:;
4496  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4497  __Pyx_RefNannyFinishContext();
4498  return NULL;
4499  __pyx_L4_argument_unpacking_done:;
4500  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
4501  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
4502  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
4503  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
4504  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4505 
4506  /* function exit code */
4507  goto __pyx_L0;
4508  __pyx_L1_error:;
4509  __pyx_r = NULL;
4510  __pyx_L0:;
4511  __Pyx_RefNannyFinishContext();
4512  return __pyx_r;
4513 }
4514 
4515 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4516  int __pyx_v_ebN;
4517  int __pyx_v_material_left;
4518  int __pyx_v_material_right;
4519  npy_intp __pyx_v_k;
4520  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4521  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4522  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4523  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4524  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4525  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4526  PyObject *__pyx_r = NULL;
4527  __Pyx_RefNannyDeclarations
4528  npy_intp __pyx_t_1;
4529  npy_intp __pyx_t_2;
4530  int __pyx_t_3;
4531  Py_ssize_t __pyx_t_4;
4532  Py_ssize_t __pyx_t_5;
4533  int __pyx_t_6;
4534  npy_intp __pyx_t_7;
4535  npy_intp __pyx_t_8;
4536  npy_intp __pyx_t_9;
4537  PyObject *__pyx_t_10 = NULL;
4538  PyObject *__pyx_t_11 = NULL;
4539  PyObject *__pyx_t_12 = NULL;
4540  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
4541  int __pyx_lineno = 0;
4542  const char *__pyx_filename = NULL;
4543  int __pyx_clineno = 0;
4544  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
4545  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4546  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4547  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4548  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4549  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4550  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4551  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4552  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4553  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4554  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4555  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4556  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4557  {
4558  __Pyx_BufFmt_StackElem __pyx_stack[1];
4559  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4560  }
4561  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4562  {
4563  __Pyx_BufFmt_StackElem __pyx_stack[1];
4564  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4565  }
4566  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4567  {
4568  __Pyx_BufFmt_StackElem __pyx_stack[1];
4569  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4570  }
4571  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
4572 
4573  /* "subsurfaceTransportFunctions.pyx":131
4574  * cdef int ebN,material_left,material_right
4575  *
4576  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4577  * material_left = elementBoundaryTypes[ebN,0]
4578  * material_right= elementBoundaryTypes[ebN,1]
4579  */
4580  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4581  __pyx_t_2 = __pyx_t_1;
4582  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4583  __pyx_v_ebN = __pyx_t_3;
4584 
4585  /* "subsurfaceTransportFunctions.pyx":132
4586  *
4587  * for ebN in range(ebq_global_vals.shape[0]):
4588  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4589  * material_right= elementBoundaryTypes[ebN,1]
4590  * for k in range(ebq_global_vals.shape[1]):
4591  */
4592  __pyx_t_4 = __pyx_v_ebN;
4593  __pyx_t_5 = 0;
4594  __pyx_t_6 = -1;
4595  if (__pyx_t_4 < 0) {
4596  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4597  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4598  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4599  if (__pyx_t_5 < 0) {
4600  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4601  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4602  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4603  if (unlikely(__pyx_t_6 != -1)) {
4604  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4605  __PYX_ERR(0, 132, __pyx_L1_error)
4606  }
4607  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4608 
4609  /* "subsurfaceTransportFunctions.pyx":133
4610  * for ebN in range(ebq_global_vals.shape[0]):
4611  * material_left = elementBoundaryTypes[ebN,0]
4612  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4613  * for k in range(ebq_global_vals.shape[1]):
4614  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4615  */
4616  __pyx_t_5 = __pyx_v_ebN;
4617  __pyx_t_4 = 1;
4618  __pyx_t_6 = -1;
4619  if (__pyx_t_5 < 0) {
4620  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4621  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4622  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4623  if (__pyx_t_4 < 0) {
4624  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4625  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
4626  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4627  if (unlikely(__pyx_t_6 != -1)) {
4628  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4629  __PYX_ERR(0, 133, __pyx_L1_error)
4630  }
4631  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4632 
4633  /* "subsurfaceTransportFunctions.pyx":134
4634  * material_left = elementBoundaryTypes[ebN,0]
4635  * material_right= elementBoundaryTypes[ebN,1]
4636  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4637  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4638  * material_functions[material_right])
4639  */
4640  __pyx_t_7 = (__pyx_v_ebq_global_vals->dimensions[1]);
4641  __pyx_t_8 = __pyx_t_7;
4642  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4643  __pyx_v_k = __pyx_t_9;
4644 
4645  /* "subsurfaceTransportFunctions.pyx":135
4646  * material_right= elementBoundaryTypes[ebN,1]
4647  * for k in range(ebq_global_vals.shape[1]):
4648  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4649  * material_functions[material_right])
4650  *
4651  */
4652  if (unlikely(__pyx_v_material_functions == Py_None)) {
4653  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4654  __PYX_ERR(0, 135, __pyx_L1_error)
4655  }
4656  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4657  __Pyx_GOTREF(__pyx_t_10);
4658  __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
4659  __Pyx_GOTREF(__pyx_t_11);
4660  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4661 
4662  /* "subsurfaceTransportFunctions.pyx":136
4663  * for k in range(ebq_global_vals.shape[1]):
4664  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4665  * material_functions[material_right]) # <<<<<<<<<<<<<<
4666  *
4667  *
4668  */
4669  if (unlikely(__pyx_v_material_functions == Py_None)) {
4670  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4671  __PYX_ERR(0, 136, __pyx_L1_error)
4672  }
4673  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
4674  __Pyx_GOTREF(__pyx_t_10);
4675  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 136, __pyx_L1_error)
4676  __Pyx_GOTREF(__pyx_t_12);
4677  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4678 
4679  /* "subsurfaceTransportFunctions.pyx":135
4680  * material_right= elementBoundaryTypes[ebN,1]
4681  * for k in range(ebq_global_vals.shape[1]):
4682  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4683  * material_functions[material_right])
4684  *
4685  */
4686  __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4687  __Pyx_GOTREF(__pyx_t_10);
4688  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4689  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4690  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4691  __Pyx_GOTREF(__pyx_t_12);
4692  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4693  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_13 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4694  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4695  __pyx_t_4 = __pyx_v_ebN;
4696  __pyx_t_5 = __pyx_v_k;
4697  __pyx_t_6 = -1;
4698  if (__pyx_t_4 < 0) {
4699  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4700  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4701  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
4702  if (__pyx_t_5 < 0) {
4703  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4704  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4705  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
4706  if (unlikely(__pyx_t_6 != -1)) {
4707  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4708  __PYX_ERR(0, 135, __pyx_L1_error)
4709  }
4710  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_13;
4711  }
4712  }
4713 
4714  /* "subsurfaceTransportFunctions.pyx":118
4715  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4716  *
4717  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4718  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4719  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4720  */
4721 
4722  /* function exit code */
4723  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4724  goto __pyx_L0;
4725  __pyx_L1_error:;
4726  __Pyx_XDECREF(__pyx_t_10);
4727  __Pyx_XDECREF(__pyx_t_11);
4728  __Pyx_XDECREF(__pyx_t_12);
4729  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4730  __Pyx_PyThreadState_declare
4731  __Pyx_PyThreadState_assign
4732  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4733  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4734  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4735  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4736  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4737  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4738  __pyx_r = NULL;
4739  goto __pyx_L2;
4740  __pyx_L0:;
4741  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4742  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4743  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4744  __pyx_L2:;
4745  __Pyx_XGIVEREF(__pyx_r);
4746  __Pyx_RefNannyFinishContext();
4747  return __pyx_r;
4748 }
4749 
4750 /* "subsurfaceTransportFunctions.pyx":139
4751  *
4752  *
4753  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4754  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4755  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4756  */
4757 
4758 /* Python wrapper */
4759 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4760 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4761 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4762 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4763  int __pyx_v_nd;
4764  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4765  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4766  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4767  PyObject *__pyx_v_material_functions = 0;
4768  int __pyx_lineno = 0;
4769  const char *__pyx_filename = NULL;
4770  int __pyx_clineno = 0;
4771  PyObject *__pyx_r = 0;
4772  __Pyx_RefNannyDeclarations
4773  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4774  {
4775  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4776  PyObject* values[5] = {0,0,0,0,0};
4777  if (unlikely(__pyx_kwds)) {
4778  Py_ssize_t kw_args;
4779  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4780  switch (pos_args) {
4781  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4782  CYTHON_FALLTHROUGH;
4783  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4784  CYTHON_FALLTHROUGH;
4785  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4786  CYTHON_FALLTHROUGH;
4787  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4788  CYTHON_FALLTHROUGH;
4789  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4790  CYTHON_FALLTHROUGH;
4791  case 0: break;
4792  default: goto __pyx_L5_argtuple_error;
4793  }
4794  kw_args = PyDict_Size(__pyx_kwds);
4795  switch (pos_args) {
4796  case 0:
4797  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4798  else goto __pyx_L5_argtuple_error;
4799  CYTHON_FALLTHROUGH;
4800  case 1:
4801  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4802  else {
4803  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 139, __pyx_L3_error)
4804  }
4805  CYTHON_FALLTHROUGH;
4806  case 2:
4807  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4808  else {
4809  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 139, __pyx_L3_error)
4810  }
4811  CYTHON_FALLTHROUGH;
4812  case 3:
4813  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4814  else {
4815  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 139, __pyx_L3_error)
4816  }
4817  CYTHON_FALLTHROUGH;
4818  case 4:
4819  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4820  else {
4821  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 139, __pyx_L3_error)
4822  }
4823  }
4824  if (unlikely(kw_args > 0)) {
4825  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
4826  }
4827  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4828  goto __pyx_L5_argtuple_error;
4829  } else {
4830  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4831  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4832  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4833  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4834  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4835  }
4836  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
4837  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4838  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4839  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4840  __pyx_v_material_functions = ((PyObject*)values[4]);
4841  }
4842  goto __pyx_L4_argument_unpacking_done;
4843  __pyx_L5_argtuple_error:;
4844  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
4845  __pyx_L3_error:;
4846  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4847  __Pyx_RefNannyFinishContext();
4848  return NULL;
4849  __pyx_L4_argument_unpacking_done:;
4850  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 140, __pyx_L1_error)
4851  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 141, __pyx_L1_error)
4852  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
4853  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 143, __pyx_L1_error)
4854  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4855 
4856  /* function exit code */
4857  goto __pyx_L0;
4858  __pyx_L1_error:;
4859  __pyx_r = NULL;
4860  __pyx_L0:;
4861  __Pyx_RefNannyFinishContext();
4862  return __pyx_r;
4863 }
4864 
4865 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4866  int __pyx_v_ebN;
4867  int __pyx_v_k;
4868  int __pyx_v_material_left;
4869  int __pyx_v_material_right;
4870  int __pyx_v_I;
4871  int __pyx_v_J;
4872  double __pyx_v_numer;
4873  double __pyx_v_denom;
4874  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4875  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4876  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4877  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4878  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4879  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4880  PyObject *__pyx_r = NULL;
4881  __Pyx_RefNannyDeclarations
4882  npy_intp __pyx_t_1;
4883  npy_intp __pyx_t_2;
4884  int __pyx_t_3;
4885  Py_ssize_t __pyx_t_4;
4886  Py_ssize_t __pyx_t_5;
4887  int __pyx_t_6;
4888  npy_intp __pyx_t_7;
4889  npy_intp __pyx_t_8;
4890  int __pyx_t_9;
4891  int __pyx_t_10;
4892  int __pyx_t_11;
4893  int __pyx_t_12;
4894  int __pyx_t_13;
4895  int __pyx_t_14;
4896  PyObject *__pyx_t_15 = NULL;
4897  PyObject *__pyx_t_16 = NULL;
4898  PyObject *__pyx_t_17 = NULL;
4899  PyObject *__pyx_t_18 = NULL;
4900  PyObject *__pyx_t_19 = NULL;
4901  double __pyx_t_20;
4902  Py_ssize_t __pyx_t_21;
4903  int __pyx_t_22;
4904  int __pyx_lineno = 0;
4905  const char *__pyx_filename = NULL;
4906  int __pyx_clineno = 0;
4907  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4908  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4909  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4910  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4911  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4912  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4913  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4914  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4915  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4916  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4917  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4918  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4919  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4920  {
4921  __Pyx_BufFmt_StackElem __pyx_stack[1];
4922  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4923  }
4924  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4925  {
4926  __Pyx_BufFmt_StackElem __pyx_stack[1];
4927  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4928  }
4929  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4930  {
4931  __Pyx_BufFmt_StackElem __pyx_stack[1];
4932  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4933  }
4934  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
4935 
4936  /* "subsurfaceTransportFunctions.pyx":154
4937  * cdef double numer,denom
4938  *
4939  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4940  * material_left = elementBoundaryTypes[ebN,0]
4941  * material_right= elementBoundaryTypes[ebN,1]
4942  */
4943  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4944  __pyx_t_2 = __pyx_t_1;
4945  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4946  __pyx_v_ebN = __pyx_t_3;
4947 
4948  /* "subsurfaceTransportFunctions.pyx":155
4949  *
4950  * for ebN in range(ebq_global_vals.shape[0]):
4951  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4952  * material_right= elementBoundaryTypes[ebN,1]
4953  * for k in range(ebq_global_vals.shape[1]):
4954  */
4955  __pyx_t_4 = __pyx_v_ebN;
4956  __pyx_t_5 = 0;
4957  __pyx_t_6 = -1;
4958  if (__pyx_t_4 < 0) {
4959  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4960  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4961  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4962  if (__pyx_t_5 < 0) {
4963  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4964  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4965  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4966  if (unlikely(__pyx_t_6 != -1)) {
4967  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4968  __PYX_ERR(0, 155, __pyx_L1_error)
4969  }
4970  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4971 
4972  /* "subsurfaceTransportFunctions.pyx":156
4973  * for ebN in range(ebq_global_vals.shape[0]):
4974  * material_left = elementBoundaryTypes[ebN,0]
4975  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4976  * for k in range(ebq_global_vals.shape[1]):
4977  * for I in range(nd):
4978  */
4979  __pyx_t_5 = __pyx_v_ebN;
4980  __pyx_t_4 = 1;
4981  __pyx_t_6 = -1;
4982  if (__pyx_t_5 < 0) {
4983  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4984  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4985  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4986  if (__pyx_t_4 < 0) {
4987  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4988  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
4989  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4990  if (unlikely(__pyx_t_6 != -1)) {
4991  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4992  __PYX_ERR(0, 156, __pyx_L1_error)
4993  }
4994  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4995 
4996  /* "subsurfaceTransportFunctions.pyx":157
4997  * material_left = elementBoundaryTypes[ebN,0]
4998  * material_right= elementBoundaryTypes[ebN,1]
4999  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
5000  * for I in range(nd):
5001  * for J in range(nd):
5002  */
5003  __pyx_t_7 = (__pyx_v_ebq_global_vals->dimensions[1]);
5004  __pyx_t_8 = __pyx_t_7;
5005  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
5006  __pyx_v_k = __pyx_t_6;
5007 
5008  /* "subsurfaceTransportFunctions.pyx":158
5009  * material_right= elementBoundaryTypes[ebN,1]
5010  * for k in range(ebq_global_vals.shape[1]):
5011  * for I in range(nd): # <<<<<<<<<<<<<<
5012  * for J in range(nd):
5013  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5014  */
5015  __pyx_t_9 = __pyx_v_nd;
5016  __pyx_t_10 = __pyx_t_9;
5017  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5018  __pyx_v_I = __pyx_t_11;
5019 
5020  /* "subsurfaceTransportFunctions.pyx":159
5021  * for k in range(ebq_global_vals.shape[1]):
5022  * for I in range(nd):
5023  * for J in range(nd): # <<<<<<<<<<<<<<
5024  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5025  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5026  */
5027  __pyx_t_12 = __pyx_v_nd;
5028  __pyx_t_13 = __pyx_t_12;
5029  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5030  __pyx_v_J = __pyx_t_14;
5031 
5032  /* "subsurfaceTransportFunctions.pyx":160
5033  * for I in range(nd):
5034  * for J in range(nd):
5035  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
5036  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5037  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5038  */
5039  if (unlikely(__pyx_v_material_functions == Py_None)) {
5040  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5041  __PYX_ERR(0, 160, __pyx_L1_error)
5042  }
5043  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5044  __Pyx_GOTREF(__pyx_t_15);
5045  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
5046  __Pyx_GOTREF(__pyx_t_16);
5047  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5048  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5049  __Pyx_GOTREF(__pyx_t_15);
5050  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5051  __Pyx_GOTREF(__pyx_t_17);
5052  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5053  __Pyx_GOTREF(__pyx_t_18);
5054  __Pyx_GIVEREF(__pyx_t_15);
5055  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_15);
5056  __Pyx_GIVEREF(__pyx_t_17);
5057  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17);
5058  __pyx_t_15 = 0;
5059  __pyx_t_17 = 0;
5060  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5061  __Pyx_GOTREF(__pyx_t_17);
5062  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5063  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5064  __pyx_t_18 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5065  __Pyx_GOTREF(__pyx_t_18);
5066  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5067  if (unlikely(__pyx_v_material_functions == Py_None)) {
5068  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5069  __PYX_ERR(0, 160, __pyx_L1_error)
5070  }
5071  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5072  __Pyx_GOTREF(__pyx_t_17);
5073  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
5074  __Pyx_GOTREF(__pyx_t_16);
5075  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5076  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5077  __Pyx_GOTREF(__pyx_t_17);
5078  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5079  __Pyx_GOTREF(__pyx_t_15);
5080  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5081  __Pyx_GOTREF(__pyx_t_19);
5082  __Pyx_GIVEREF(__pyx_t_17);
5083  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17);
5084  __Pyx_GIVEREF(__pyx_t_15);
5085  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_15);
5086  __pyx_t_17 = 0;
5087  __pyx_t_15 = 0;
5088  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5089  __Pyx_GOTREF(__pyx_t_15);
5090  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5091  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5092  __pyx_t_19 = PyNumber_Multiply(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5093  __Pyx_GOTREF(__pyx_t_19);
5094  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5095  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5096  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
5097  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5098  __pyx_v_numer = __pyx_t_20;
5099 
5100  /* "subsurfaceTransportFunctions.pyx":161
5101  * for J in range(nd):
5102  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5103  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
5104  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5105  *
5106  */
5107  if (unlikely(__pyx_v_material_functions == Py_None)) {
5108  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5109  __PYX_ERR(0, 161, __pyx_L1_error)
5110  }
5111  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5112  __Pyx_GOTREF(__pyx_t_19);
5113  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
5114  __Pyx_GOTREF(__pyx_t_15);
5115  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5116  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5117  __Pyx_GOTREF(__pyx_t_19);
5118  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5119  __Pyx_GOTREF(__pyx_t_18);
5120  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5121  __Pyx_GOTREF(__pyx_t_16);
5122  __Pyx_GIVEREF(__pyx_t_19);
5123  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_19);
5124  __Pyx_GIVEREF(__pyx_t_18);
5125  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
5126  __pyx_t_19 = 0;
5127  __pyx_t_18 = 0;
5128  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5129  __Pyx_GOTREF(__pyx_t_18);
5130  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5131  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5132  if (unlikely(__pyx_v_material_functions == Py_None)) {
5133  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5134  __PYX_ERR(0, 161, __pyx_L1_error)
5135  }
5136  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5137  __Pyx_GOTREF(__pyx_t_16);
5138  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
5139  __Pyx_GOTREF(__pyx_t_15);
5140  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5141  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5142  __Pyx_GOTREF(__pyx_t_16);
5143  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5144  __Pyx_GOTREF(__pyx_t_19);
5145  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5146  __Pyx_GOTREF(__pyx_t_17);
5147  __Pyx_GIVEREF(__pyx_t_16);
5148  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16);
5149  __Pyx_GIVEREF(__pyx_t_19);
5150  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_19);
5151  __pyx_t_16 = 0;
5152  __pyx_t_19 = 0;
5153  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5154  __Pyx_GOTREF(__pyx_t_19);
5155  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5156  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5157  __pyx_t_17 = PyNumber_Add(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5158  __Pyx_GOTREF(__pyx_t_17);
5159  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5160  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5161  __pyx_t_19 = __Pyx_PyFloat_AddObjC(__pyx_t_17, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5162  __Pyx_GOTREF(__pyx_t_19);
5163  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5164  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
5165  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5166  __pyx_v_denom = __pyx_t_20;
5167 
5168  /* "subsurfaceTransportFunctions.pyx":162
5169  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5170  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5171  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
5172  *
5173  * ###
5174  */
5175  if (unlikely(__pyx_v_denom == 0)) {
5176  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5177  __PYX_ERR(0, 162, __pyx_L1_error)
5178  }
5179  __pyx_t_4 = __pyx_v_ebN;
5180  __pyx_t_5 = __pyx_v_k;
5181  __pyx_t_21 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
5182  __pyx_t_22 = -1;
5183  if (__pyx_t_4 < 0) {
5184  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
5185  if (unlikely(__pyx_t_4 < 0)) __pyx_t_22 = 0;
5186  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
5187  if (__pyx_t_5 < 0) {
5188  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
5189  if (unlikely(__pyx_t_5 < 0)) __pyx_t_22 = 1;
5190  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
5191  if (__pyx_t_21 < 0) {
5192  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
5193  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 2;
5194  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
5195  if (unlikely(__pyx_t_22 != -1)) {
5196  __Pyx_RaiseBufferIndexError(__pyx_t_22);
5197  __PYX_ERR(0, 162, __pyx_L1_error)
5198  }
5199  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
5200  }
5201  }
5202  }
5203  }
5204 
5205  /* "subsurfaceTransportFunctions.pyx":139
5206  *
5207  *
5208  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
5209  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5210  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5211  */
5212 
5213  /* function exit code */
5214  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5215  goto __pyx_L0;
5216  __pyx_L1_error:;
5217  __Pyx_XDECREF(__pyx_t_15);
5218  __Pyx_XDECREF(__pyx_t_16);
5219  __Pyx_XDECREF(__pyx_t_17);
5220  __Pyx_XDECREF(__pyx_t_18);
5221  __Pyx_XDECREF(__pyx_t_19);
5222  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5223  __Pyx_PyThreadState_declare
5224  __Pyx_PyThreadState_assign
5225  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5226  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5227  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5228  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5229  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5230  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5231  __pyx_r = NULL;
5232  goto __pyx_L2;
5233  __pyx_L0:;
5234  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5235  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5236  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5237  __pyx_L2:;
5238  __Pyx_XGIVEREF(__pyx_r);
5239  __Pyx_RefNannyFinishContext();
5240  return __pyx_r;
5241 }
5242 
5243 /* "subsurfaceTransportFunctions.pyx":165
5244  *
5245  * ###
5246  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5247  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5248  * numpy.ndarray[DTYPE_t,ndim=3] x,
5249  */
5250 
5251 /* Python wrapper */
5252 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5253 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
5254 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
5255 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5256  double __pyx_v_t;
5257  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5258  PyArrayObject *__pyx_v_x = 0;
5259  PyArrayObject *__pyx_v_q_vals = 0;
5260  PyObject *__pyx_v_material_functions = 0;
5261  int __pyx_lineno = 0;
5262  const char *__pyx_filename = NULL;
5263  int __pyx_clineno = 0;
5264  PyObject *__pyx_r = 0;
5265  __Pyx_RefNannyDeclarations
5266  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
5267  {
5268  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5269  PyObject* values[5] = {0,0,0,0,0};
5270  if (unlikely(__pyx_kwds)) {
5271  Py_ssize_t kw_args;
5272  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5273  switch (pos_args) {
5274  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5275  CYTHON_FALLTHROUGH;
5276  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5277  CYTHON_FALLTHROUGH;
5278  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5279  CYTHON_FALLTHROUGH;
5280  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5281  CYTHON_FALLTHROUGH;
5282  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5283  CYTHON_FALLTHROUGH;
5284  case 0: break;
5285  default: goto __pyx_L5_argtuple_error;
5286  }
5287  kw_args = PyDict_Size(__pyx_kwds);
5288  switch (pos_args) {
5289  case 0:
5290  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5291  else goto __pyx_L5_argtuple_error;
5292  CYTHON_FALLTHROUGH;
5293  case 1:
5294  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5295  else {
5296  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 165, __pyx_L3_error)
5297  }
5298  CYTHON_FALLTHROUGH;
5299  case 2:
5300  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5301  else {
5302  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 165, __pyx_L3_error)
5303  }
5304  CYTHON_FALLTHROUGH;
5305  case 3:
5306  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5307  else {
5308  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 165, __pyx_L3_error)
5309  }
5310  CYTHON_FALLTHROUGH;
5311  case 4:
5312  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5313  else {
5314  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 165, __pyx_L3_error)
5315  }
5316  }
5317  if (unlikely(kw_args > 0)) {
5318  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
5319  }
5320  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5321  goto __pyx_L5_argtuple_error;
5322  } else {
5323  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5324  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5325  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5326  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5327  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5328  }
5329  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
5330  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5331  __pyx_v_x = ((PyArrayObject *)values[2]);
5332  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5333  __pyx_v_material_functions = ((PyObject*)values[4]);
5334  }
5335  goto __pyx_L4_argument_unpacking_done;
5336  __pyx_L5_argtuple_error:;
5337  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
5338  __pyx_L3_error:;
5339  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5340  __Pyx_RefNannyFinishContext();
5341  return NULL;
5342  __pyx_L4_argument_unpacking_done:;
5343  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
5344  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
5345  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
5346  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
5347  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5348 
5349  /* function exit code */
5350  goto __pyx_L0;
5351  __pyx_L1_error:;
5352  __pyx_r = NULL;
5353  __pyx_L0:;
5354  __Pyx_RefNannyFinishContext();
5355  return __pyx_r;
5356 }
5357 
5358 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5359  int __pyx_v_eN;
5360  int __pyx_v_k;
5361  int __pyx_v_material;
5362  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5363  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5364  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5365  __Pyx_Buffer __pyx_pybuffer_q_vals;
5366  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5367  __Pyx_Buffer __pyx_pybuffer_x;
5368  PyObject *__pyx_r = NULL;
5369  __Pyx_RefNannyDeclarations
5370  npy_intp __pyx_t_1;
5371  npy_intp __pyx_t_2;
5372  int __pyx_t_3;
5373  Py_ssize_t __pyx_t_4;
5374  int __pyx_t_5;
5375  npy_intp __pyx_t_6;
5376  npy_intp __pyx_t_7;
5377  PyObject *__pyx_t_8 = NULL;
5378  PyObject *__pyx_t_9 = NULL;
5379  PyObject *__pyx_t_10 = NULL;
5380  PyObject *__pyx_t_11 = NULL;
5381  PyObject *__pyx_t_12 = NULL;
5382  int __pyx_t_13;
5383  PyObject *__pyx_t_14 = NULL;
5384  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
5385  Py_ssize_t __pyx_t_16;
5386  int __pyx_lineno = 0;
5387  const char *__pyx_filename = NULL;
5388  int __pyx_clineno = 0;
5389  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
5390  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5391  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5392  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5393  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5394  __pyx_pybuffer_x.pybuffer.buf = NULL;
5395  __pyx_pybuffer_x.refcount = 0;
5396  __pyx_pybuffernd_x.data = NULL;
5397  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5398  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5399  __pyx_pybuffer_q_vals.refcount = 0;
5400  __pyx_pybuffernd_q_vals.data = NULL;
5401  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5402  {
5403  __Pyx_BufFmt_StackElem __pyx_stack[1];
5404  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5405  }
5406  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5407  {
5408  __Pyx_BufFmt_StackElem __pyx_stack[1];
5409  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5410  }
5411  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5412  {
5413  __Pyx_BufFmt_StackElem __pyx_stack[1];
5414  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5415  }
5416  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
5417 
5418  /* "subsurfaceTransportFunctions.pyx":175
5419  * """
5420  * cdef int eN,k,material
5421  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5422  * material = elementMaterialTypes[eN]
5423  * for k in range(x.shape[1]):
5424  */
5425  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5426  __pyx_t_2 = __pyx_t_1;
5427  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5428  __pyx_v_eN = __pyx_t_3;
5429 
5430  /* "subsurfaceTransportFunctions.pyx":176
5431  * cdef int eN,k,material
5432  * for eN in range(x.shape[0]):
5433  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5434  * for k in range(x.shape[1]):
5435  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5436  */
5437  __pyx_t_4 = __pyx_v_eN;
5438  __pyx_t_5 = -1;
5439  if (__pyx_t_4 < 0) {
5440  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5441  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5442  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5443  if (unlikely(__pyx_t_5 != -1)) {
5444  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5445  __PYX_ERR(0, 176, __pyx_L1_error)
5446  }
5447  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5448 
5449  /* "subsurfaceTransportFunctions.pyx":177
5450  * for eN in range(x.shape[0]):
5451  * material = elementMaterialTypes[eN]
5452  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5453  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5454  *
5455  */
5456  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5457  __pyx_t_7 = __pyx_t_6;
5458  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5459  __pyx_v_k = __pyx_t_5;
5460 
5461  /* "subsurfaceTransportFunctions.pyx":178
5462  * material = elementMaterialTypes[eN]
5463  * for k in range(x.shape[1]):
5464  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
5465  *
5466  * def evaluateVectorMaterialFunctionOverElements(double t,
5467  */
5468  if (unlikely(__pyx_v_material_functions == Py_None)) {
5469  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5470  __PYX_ERR(0, 178, __pyx_L1_error)
5471  }
5472  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5473  __Pyx_GOTREF(__pyx_t_9);
5474  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5475  __Pyx_GOTREF(__pyx_t_10);
5476  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5477  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5478  __Pyx_GOTREF(__pyx_t_9);
5479  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5480  __Pyx_GOTREF(__pyx_t_11);
5481  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5482  __Pyx_GOTREF(__pyx_t_12);
5483  __Pyx_GIVEREF(__pyx_t_9);
5484  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5485  __Pyx_GIVEREF(__pyx_t_11);
5486  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5487  __pyx_t_9 = 0;
5488  __pyx_t_11 = 0;
5489  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5490  __Pyx_GOTREF(__pyx_t_11);
5491  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5492  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5493  __Pyx_GOTREF(__pyx_t_12);
5494  __pyx_t_9 = NULL;
5495  __pyx_t_13 = 0;
5496  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5497  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5498  if (likely(__pyx_t_9)) {
5499  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5500  __Pyx_INCREF(__pyx_t_9);
5501  __Pyx_INCREF(function);
5502  __Pyx_DECREF_SET(__pyx_t_10, function);
5503  __pyx_t_13 = 1;
5504  }
5505  }
5506  #if CYTHON_FAST_PYCALL
5507  if (PyFunction_Check(__pyx_t_10)) {
5508  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5509  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5510  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5511  __Pyx_GOTREF(__pyx_t_8);
5512  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5513  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5514  } else
5515  #endif
5516  #if CYTHON_FAST_PYCCALL
5517  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5518  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5519  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5520  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5521  __Pyx_GOTREF(__pyx_t_8);
5522  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5523  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5524  } else
5525  #endif
5526  {
5527  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 178, __pyx_L1_error)
5528  __Pyx_GOTREF(__pyx_t_14);
5529  if (__pyx_t_9) {
5530  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5531  }
5532  __Pyx_GIVEREF(__pyx_t_11);
5533  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5534  __Pyx_GIVEREF(__pyx_t_12);
5535  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5536  __pyx_t_11 = 0;
5537  __pyx_t_12 = 0;
5538  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5539  __Pyx_GOTREF(__pyx_t_8);
5540  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5541  }
5542  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5543  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5544  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5545  __pyx_t_4 = __pyx_v_eN;
5546  __pyx_t_16 = __pyx_v_k;
5547  __pyx_t_13 = -1;
5548  if (__pyx_t_4 < 0) {
5549  __pyx_t_4 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
5550  if (unlikely(__pyx_t_4 < 0)) __pyx_t_13 = 0;
5551  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
5552  if (__pyx_t_16 < 0) {
5553  __pyx_t_16 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
5554  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 1;
5555  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
5556  if (unlikely(__pyx_t_13 != -1)) {
5557  __Pyx_RaiseBufferIndexError(__pyx_t_13);
5558  __PYX_ERR(0, 178, __pyx_L1_error)
5559  }
5560  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_15;
5561  }
5562  }
5563 
5564  /* "subsurfaceTransportFunctions.pyx":165
5565  *
5566  * ###
5567  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5568  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5569  * numpy.ndarray[DTYPE_t,ndim=3] x,
5570  */
5571 
5572  /* function exit code */
5573  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5574  goto __pyx_L0;
5575  __pyx_L1_error:;
5576  __Pyx_XDECREF(__pyx_t_8);
5577  __Pyx_XDECREF(__pyx_t_9);
5578  __Pyx_XDECREF(__pyx_t_10);
5579  __Pyx_XDECREF(__pyx_t_11);
5580  __Pyx_XDECREF(__pyx_t_12);
5581  __Pyx_XDECREF(__pyx_t_14);
5582  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5583  __Pyx_PyThreadState_declare
5584  __Pyx_PyThreadState_assign
5585  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5586  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5587  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5588  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5589  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5590  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5591  __pyx_r = NULL;
5592  goto __pyx_L2;
5593  __pyx_L0:;
5594  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5595  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5596  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5597  __pyx_L2:;
5598  __Pyx_XGIVEREF(__pyx_r);
5599  __Pyx_RefNannyFinishContext();
5600  return __pyx_r;
5601 }
5602 
5603 /* "subsurfaceTransportFunctions.pyx":180
5604  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5605  *
5606  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5607  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5608  * numpy.ndarray[DTYPE_t,ndim=3] x,
5609  */
5610 
5611 /* Python wrapper */
5612 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5613 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
5614 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
5615 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5616  double __pyx_v_t;
5617  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5618  PyArrayObject *__pyx_v_x = 0;
5619  PyArrayObject *__pyx_v_q_vals = 0;
5620  PyObject *__pyx_v_material_functions = 0;
5621  int __pyx_lineno = 0;
5622  const char *__pyx_filename = NULL;
5623  int __pyx_clineno = 0;
5624  PyObject *__pyx_r = 0;
5625  __Pyx_RefNannyDeclarations
5626  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
5627  {
5628  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5629  PyObject* values[5] = {0,0,0,0,0};
5630  if (unlikely(__pyx_kwds)) {
5631  Py_ssize_t kw_args;
5632  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5633  switch (pos_args) {
5634  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5635  CYTHON_FALLTHROUGH;
5636  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5637  CYTHON_FALLTHROUGH;
5638  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5639  CYTHON_FALLTHROUGH;
5640  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5641  CYTHON_FALLTHROUGH;
5642  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5643  CYTHON_FALLTHROUGH;
5644  case 0: break;
5645  default: goto __pyx_L5_argtuple_error;
5646  }
5647  kw_args = PyDict_Size(__pyx_kwds);
5648  switch (pos_args) {
5649  case 0:
5650  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5651  else goto __pyx_L5_argtuple_error;
5652  CYTHON_FALLTHROUGH;
5653  case 1:
5654  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5655  else {
5656  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 180, __pyx_L3_error)
5657  }
5658  CYTHON_FALLTHROUGH;
5659  case 2:
5660  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5661  else {
5662  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 180, __pyx_L3_error)
5663  }
5664  CYTHON_FALLTHROUGH;
5665  case 3:
5666  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5667  else {
5668  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 180, __pyx_L3_error)
5669  }
5670  CYTHON_FALLTHROUGH;
5671  case 4:
5672  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5673  else {
5674  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 180, __pyx_L3_error)
5675  }
5676  }
5677  if (unlikely(kw_args > 0)) {
5678  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
5679  }
5680  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5681  goto __pyx_L5_argtuple_error;
5682  } else {
5683  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5684  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5685  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5686  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5687  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5688  }
5689  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
5690  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5691  __pyx_v_x = ((PyArrayObject *)values[2]);
5692  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5693  __pyx_v_material_functions = ((PyObject*)values[4]);
5694  }
5695  goto __pyx_L4_argument_unpacking_done;
5696  __pyx_L5_argtuple_error:;
5697  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
5698  __pyx_L3_error:;
5699  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5700  __Pyx_RefNannyFinishContext();
5701  return NULL;
5702  __pyx_L4_argument_unpacking_done:;
5703  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 181, __pyx_L1_error)
5704  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
5705  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
5706  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 184, __pyx_L1_error)
5707  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5708 
5709  /* function exit code */
5710  goto __pyx_L0;
5711  __pyx_L1_error:;
5712  __pyx_r = NULL;
5713  __pyx_L0:;
5714  __Pyx_RefNannyFinishContext();
5715  return __pyx_r;
5716 }
5717 
5718 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5719  int __pyx_v_eN;
5720  int __pyx_v_k;
5721  int __pyx_v_material;
5722  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5723  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5724  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5725  __Pyx_Buffer __pyx_pybuffer_q_vals;
5726  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5727  __Pyx_Buffer __pyx_pybuffer_x;
5728  PyObject *__pyx_r = NULL;
5729  __Pyx_RefNannyDeclarations
5730  npy_intp __pyx_t_1;
5731  npy_intp __pyx_t_2;
5732  int __pyx_t_3;
5733  Py_ssize_t __pyx_t_4;
5734  int __pyx_t_5;
5735  npy_intp __pyx_t_6;
5736  npy_intp __pyx_t_7;
5737  PyObject *__pyx_t_8 = NULL;
5738  PyObject *__pyx_t_9 = NULL;
5739  PyObject *__pyx_t_10 = NULL;
5740  PyObject *__pyx_t_11 = NULL;
5741  PyObject *__pyx_t_12 = NULL;
5742  int __pyx_t_13;
5743  PyObject *__pyx_t_14 = NULL;
5744  int __pyx_lineno = 0;
5745  const char *__pyx_filename = NULL;
5746  int __pyx_clineno = 0;
5747  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5748  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5749  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5750  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5751  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5752  __pyx_pybuffer_x.pybuffer.buf = NULL;
5753  __pyx_pybuffer_x.refcount = 0;
5754  __pyx_pybuffernd_x.data = NULL;
5755  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5756  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5757  __pyx_pybuffer_q_vals.refcount = 0;
5758  __pyx_pybuffernd_q_vals.data = NULL;
5759  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5760  {
5761  __Pyx_BufFmt_StackElem __pyx_stack[1];
5762  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5763  }
5764  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5765  {
5766  __Pyx_BufFmt_StackElem __pyx_stack[1];
5767  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5768  }
5769  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5770  {
5771  __Pyx_BufFmt_StackElem __pyx_stack[1];
5772  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5773  }
5774  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5775 
5776  /* "subsurfaceTransportFunctions.pyx":189
5777  * """
5778  * cdef int eN,k,material
5779  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5780  * material = elementMaterialTypes[eN]
5781  * for k in range(x.shape[1]):
5782  */
5783  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5784  __pyx_t_2 = __pyx_t_1;
5785  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5786  __pyx_v_eN = __pyx_t_3;
5787 
5788  /* "subsurfaceTransportFunctions.pyx":190
5789  * cdef int eN,k,material
5790  * for eN in range(x.shape[0]):
5791  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5792  * for k in range(x.shape[1]):
5793  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5794  */
5795  __pyx_t_4 = __pyx_v_eN;
5796  __pyx_t_5 = -1;
5797  if (__pyx_t_4 < 0) {
5798  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5799  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5800  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5801  if (unlikely(__pyx_t_5 != -1)) {
5802  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5803  __PYX_ERR(0, 190, __pyx_L1_error)
5804  }
5805  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5806 
5807  /* "subsurfaceTransportFunctions.pyx":191
5808  * for eN in range(x.shape[0]):
5809  * material = elementMaterialTypes[eN]
5810  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5811  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5812  *
5813  */
5814  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5815  __pyx_t_7 = __pyx_t_6;
5816  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5817  __pyx_v_k = __pyx_t_5;
5818 
5819  /* "subsurfaceTransportFunctions.pyx":192
5820  * material = elementMaterialTypes[eN]
5821  * for k in range(x.shape[1]):
5822  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5823  *
5824  *
5825  */
5826  if (unlikely(__pyx_v_material_functions == Py_None)) {
5827  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5828  __PYX_ERR(0, 192, __pyx_L1_error)
5829  }
5830  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5831  __Pyx_GOTREF(__pyx_t_9);
5832  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5833  __Pyx_GOTREF(__pyx_t_10);
5834  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5835  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5836  __Pyx_GOTREF(__pyx_t_9);
5837  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5838  __Pyx_GOTREF(__pyx_t_11);
5839  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5840  __Pyx_GOTREF(__pyx_t_12);
5841  __Pyx_GIVEREF(__pyx_t_9);
5842  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5843  __Pyx_GIVEREF(__pyx_t_11);
5844  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5845  __pyx_t_9 = 0;
5846  __pyx_t_11 = 0;
5847  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5848  __Pyx_GOTREF(__pyx_t_11);
5849  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5850  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5851  __Pyx_GOTREF(__pyx_t_12);
5852  __pyx_t_9 = NULL;
5853  __pyx_t_13 = 0;
5854  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5855  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5856  if (likely(__pyx_t_9)) {
5857  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5858  __Pyx_INCREF(__pyx_t_9);
5859  __Pyx_INCREF(function);
5860  __Pyx_DECREF_SET(__pyx_t_10, function);
5861  __pyx_t_13 = 1;
5862  }
5863  }
5864  #if CYTHON_FAST_PYCALL
5865  if (PyFunction_Check(__pyx_t_10)) {
5866  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5867  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5868  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5869  __Pyx_GOTREF(__pyx_t_8);
5870  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5871  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5872  } else
5873  #endif
5874  #if CYTHON_FAST_PYCCALL
5875  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5876  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5877  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5878  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5879  __Pyx_GOTREF(__pyx_t_8);
5880  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5881  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5882  } else
5883  #endif
5884  {
5885  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5886  __Pyx_GOTREF(__pyx_t_14);
5887  if (__pyx_t_9) {
5888  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5889  }
5890  __Pyx_GIVEREF(__pyx_t_11);
5891  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5892  __Pyx_GIVEREF(__pyx_t_12);
5893  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5894  __pyx_t_11 = 0;
5895  __pyx_t_12 = 0;
5896  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5897  __Pyx_GOTREF(__pyx_t_8);
5898  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5899  }
5900  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5901  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5902  __Pyx_GOTREF(__pyx_t_10);
5903  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5904  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5905  __Pyx_GOTREF(__pyx_t_8);
5906  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5907  __Pyx_GOTREF(__pyx_t_14);
5908  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5909  __Pyx_GOTREF(__pyx_t_12);
5910  __Pyx_GIVEREF(__pyx_t_8);
5911  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
5912  __Pyx_GIVEREF(__pyx_t_14);
5913  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14);
5914  __Pyx_INCREF(__pyx_slice_);
5915  __Pyx_GIVEREF(__pyx_slice_);
5916  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_slice_);
5917  __pyx_t_8 = 0;
5918  __pyx_t_14 = 0;
5919  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_12, __pyx_t_10) < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
5920  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5921  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5922  }
5923  }
5924 
5925  /* "subsurfaceTransportFunctions.pyx":180
5926  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5927  *
5928  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5929  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5930  * numpy.ndarray[DTYPE_t,ndim=3] x,
5931  */
5932 
5933  /* function exit code */
5934  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5935  goto __pyx_L0;
5936  __pyx_L1_error:;
5937  __Pyx_XDECREF(__pyx_t_8);
5938  __Pyx_XDECREF(__pyx_t_9);
5939  __Pyx_XDECREF(__pyx_t_10);
5940  __Pyx_XDECREF(__pyx_t_11);
5941  __Pyx_XDECREF(__pyx_t_12);
5942  __Pyx_XDECREF(__pyx_t_14);
5943  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5944  __Pyx_PyThreadState_declare
5945  __Pyx_PyThreadState_assign
5946  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5947  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5948  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5949  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5950  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5951  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5952  __pyx_r = NULL;
5953  goto __pyx_L2;
5954  __pyx_L0:;
5955  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5956  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5957  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5958  __pyx_L2:;
5959  __Pyx_XGIVEREF(__pyx_r);
5960  __Pyx_RefNannyFinishContext();
5961  return __pyx_r;
5962 }
5963 
5964 /* "subsurfaceTransportFunctions.pyx":195
5965  *
5966  *
5967  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5968  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5969  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5970  */
5971 
5972 /* Python wrapper */
5973 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5974 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5975 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
5976 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5977  double __pyx_v_t;
5978  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5979  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5980  PyArrayObject *__pyx_v_x = 0;
5981  PyArrayObject *__pyx_v_ebq_vals = 0;
5982  PyObject *__pyx_v_material_functions = 0;
5983  int __pyx_lineno = 0;
5984  const char *__pyx_filename = NULL;
5985  int __pyx_clineno = 0;
5986  PyObject *__pyx_r = 0;
5987  __Pyx_RefNannyDeclarations
5988  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
5989  {
5990  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5991  PyObject* values[6] = {0,0,0,0,0,0};
5992  if (unlikely(__pyx_kwds)) {
5993  Py_ssize_t kw_args;
5994  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5995  switch (pos_args) {
5996  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5997  CYTHON_FALLTHROUGH;
5998  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5999  CYTHON_FALLTHROUGH;
6000  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6001  CYTHON_FALLTHROUGH;
6002  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6003  CYTHON_FALLTHROUGH;
6004  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6005  CYTHON_FALLTHROUGH;
6006  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6007  CYTHON_FALLTHROUGH;
6008  case 0: break;
6009  default: goto __pyx_L5_argtuple_error;
6010  }
6011  kw_args = PyDict_Size(__pyx_kwds);
6012  switch (pos_args) {
6013  case 0:
6014  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6015  else goto __pyx_L5_argtuple_error;
6016  CYTHON_FALLTHROUGH;
6017  case 1:
6018  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6019  else {
6020  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 195, __pyx_L3_error)
6021  }
6022  CYTHON_FALLTHROUGH;
6023  case 2:
6024  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6025  else {
6026  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 195, __pyx_L3_error)
6027  }
6028  CYTHON_FALLTHROUGH;
6029  case 3:
6030  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6031  else {
6032  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 195, __pyx_L3_error)
6033  }
6034  CYTHON_FALLTHROUGH;
6035  case 4:
6036  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6037  else {
6038  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 195, __pyx_L3_error)
6039  }
6040  CYTHON_FALLTHROUGH;
6041  case 5:
6042  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6043  else {
6044  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 195, __pyx_L3_error)
6045  }
6046  }
6047  if (unlikely(kw_args > 0)) {
6048  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 195, __pyx_L3_error)
6049  }
6050  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6051  goto __pyx_L5_argtuple_error;
6052  } else {
6053  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6054  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6055  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6056  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6057  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6058  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6059  }
6060  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
6061  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
6062  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
6063  __pyx_v_x = ((PyArrayObject *)values[3]);
6064  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
6065  __pyx_v_material_functions = ((PyObject*)values[5]);
6066  }
6067  goto __pyx_L4_argument_unpacking_done;
6068  __pyx_L5_argtuple_error:;
6069  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error)
6070  __pyx_L3_error:;
6071  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6072  __Pyx_RefNannyFinishContext();
6073  return NULL;
6074  __pyx_L4_argument_unpacking_done:;
6075  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
6076  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
6077  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
6078  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
6079  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 200, __pyx_L1_error)
6080  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6081 
6082  /* function exit code */
6083  goto __pyx_L0;
6084  __pyx_L1_error:;
6085  __pyx_r = NULL;
6086  __pyx_L0:;
6087  __Pyx_RefNannyFinishContext();
6088  return __pyx_r;
6089 }
6090 
6091 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6092  int __pyx_v_eN;
6093  int __pyx_v_ebN;
6094  int __pyx_v_ebN_local;
6095  int __pyx_v_k;
6096  int __pyx_v_material_left;
6097  int __pyx_v_material_right;
6098  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6099  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6100  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6101  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6102  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6103  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6104  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6105  __Pyx_Buffer __pyx_pybuffer_x;
6106  PyObject *__pyx_r = NULL;
6107  __Pyx_RefNannyDeclarations
6108  npy_intp __pyx_t_1;
6109  npy_intp __pyx_t_2;
6110  int __pyx_t_3;
6111  npy_intp __pyx_t_4;
6112  npy_intp __pyx_t_5;
6113  int __pyx_t_6;
6114  Py_ssize_t __pyx_t_7;
6115  Py_ssize_t __pyx_t_8;
6116  int __pyx_t_9;
6117  npy_intp __pyx_t_10;
6118  npy_intp __pyx_t_11;
6119  PyObject *__pyx_t_12 = NULL;
6120  PyObject *__pyx_t_13 = NULL;
6121  PyObject *__pyx_t_14 = NULL;
6122  PyObject *__pyx_t_15 = NULL;
6123  PyObject *__pyx_t_16 = NULL;
6124  PyObject *__pyx_t_17 = NULL;
6125  int __pyx_t_18;
6126  PyObject *__pyx_t_19 = NULL;
6127  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
6128  Py_ssize_t __pyx_t_21;
6129  int __pyx_lineno = 0;
6130  const char *__pyx_filename = NULL;
6131  int __pyx_clineno = 0;
6132  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
6133  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6134  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6135  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6136  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6137  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6138  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6139  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6140  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6141  __pyx_pybuffer_x.pybuffer.buf = NULL;
6142  __pyx_pybuffer_x.refcount = 0;
6143  __pyx_pybuffernd_x.data = NULL;
6144  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6145  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6146  __pyx_pybuffer_ebq_vals.refcount = 0;
6147  __pyx_pybuffernd_ebq_vals.data = NULL;
6148  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6149  {
6150  __Pyx_BufFmt_StackElem __pyx_stack[1];
6151  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6152  }
6153  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6154  {
6155  __Pyx_BufFmt_StackElem __pyx_stack[1];
6156  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6157  }
6158  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6159  {
6160  __Pyx_BufFmt_StackElem __pyx_stack[1];
6161  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6162  }
6163  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6164  {
6165  __Pyx_BufFmt_StackElem __pyx_stack[1];
6166  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6167  }
6168  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
6169 
6170  /* "subsurfaceTransportFunctions.pyx":210
6171  * cdef int eN,ebN,ebN_local,k,material_left,material_right
6172  *
6173  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6174  * for ebN_local in range(x.shape[1]):
6175  * ebN = elementBoundariesArray[eN,ebN_local]
6176  */
6177  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6178  __pyx_t_2 = __pyx_t_1;
6179  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6180  __pyx_v_eN = __pyx_t_3;
6181 
6182  /* "subsurfaceTransportFunctions.pyx":211
6183  *
6184  * for eN in range(x.shape[0]):
6185  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6186  * ebN = elementBoundariesArray[eN,ebN_local]
6187  * material_left = elementBoundaryTypes[ebN,0]
6188  */
6189  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6190  __pyx_t_5 = __pyx_t_4;
6191  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6192  __pyx_v_ebN_local = __pyx_t_6;
6193 
6194  /* "subsurfaceTransportFunctions.pyx":212
6195  * for eN in range(x.shape[0]):
6196  * for ebN_local in range(x.shape[1]):
6197  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6198  * material_left = elementBoundaryTypes[ebN,0]
6199  * material_right= elementBoundaryTypes[ebN,1]
6200  */
6201  __pyx_t_7 = __pyx_v_eN;
6202  __pyx_t_8 = __pyx_v_ebN_local;
6203  __pyx_t_9 = -1;
6204  if (__pyx_t_7 < 0) {
6205  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6206  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6207  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6208  if (__pyx_t_8 < 0) {
6209  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6210  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6211  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6212  if (unlikely(__pyx_t_9 != -1)) {
6213  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6214  __PYX_ERR(0, 212, __pyx_L1_error)
6215  }
6216  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6217 
6218  /* "subsurfaceTransportFunctions.pyx":213
6219  * for ebN_local in range(x.shape[1]):
6220  * ebN = elementBoundariesArray[eN,ebN_local]
6221  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6222  * material_right= elementBoundaryTypes[ebN,1]
6223  * for k in range(x.shape[2]):
6224  */
6225  __pyx_t_8 = __pyx_v_ebN;
6226  __pyx_t_7 = 0;
6227  __pyx_t_9 = -1;
6228  if (__pyx_t_8 < 0) {
6229  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6230  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
6231  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6232  if (__pyx_t_7 < 0) {
6233  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6234  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
6235  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6236  if (unlikely(__pyx_t_9 != -1)) {
6237  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6238  __PYX_ERR(0, 213, __pyx_L1_error)
6239  }
6240  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6241 
6242  /* "subsurfaceTransportFunctions.pyx":214
6243  * ebN = elementBoundariesArray[eN,ebN_local]
6244  * material_left = elementBoundaryTypes[ebN,0]
6245  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6246  * for k in range(x.shape[2]):
6247  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6248  */
6249  __pyx_t_7 = __pyx_v_ebN;
6250  __pyx_t_8 = 1;
6251  __pyx_t_9 = -1;
6252  if (__pyx_t_7 < 0) {
6253  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6254  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6255  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6256  if (__pyx_t_8 < 0) {
6257  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6258  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6259  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6260  if (unlikely(__pyx_t_9 != -1)) {
6261  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6262  __PYX_ERR(0, 214, __pyx_L1_error)
6263  }
6264  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6265 
6266  /* "subsurfaceTransportFunctions.pyx":215
6267  * material_left = elementBoundaryTypes[ebN,0]
6268  * material_right= elementBoundaryTypes[ebN,1]
6269  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6270  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6271  * material_functions[material_right](x[eN,ebN_local,k],t))
6272  */
6273  __pyx_t_10 = (__pyx_v_x->dimensions[2]);
6274  __pyx_t_11 = __pyx_t_10;
6275  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
6276  __pyx_v_k = __pyx_t_9;
6277 
6278  /* "subsurfaceTransportFunctions.pyx":216
6279  * material_right= elementBoundaryTypes[ebN,1]
6280  * for k in range(x.shape[2]):
6281  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6282  * material_functions[material_right](x[eN,ebN_local,k],t))
6283  *
6284  */
6285  if (unlikely(__pyx_v_material_functions == Py_None)) {
6286  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6287  __PYX_ERR(0, 216, __pyx_L1_error)
6288  }
6289  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6290  __Pyx_GOTREF(__pyx_t_13);
6291  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
6292  __Pyx_GOTREF(__pyx_t_14);
6293  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6294  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6295  __Pyx_GOTREF(__pyx_t_13);
6296  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 216, __pyx_L1_error)
6297  __Pyx_GOTREF(__pyx_t_15);
6298  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6299  __Pyx_GOTREF(__pyx_t_16);
6300  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6301  __Pyx_GOTREF(__pyx_t_17);
6302  __Pyx_GIVEREF(__pyx_t_13);
6303  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_13);
6304  __Pyx_GIVEREF(__pyx_t_15);
6305  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_15);
6306  __Pyx_GIVEREF(__pyx_t_16);
6307  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_16);
6308  __pyx_t_13 = 0;
6309  __pyx_t_15 = 0;
6310  __pyx_t_16 = 0;
6311  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6312  __Pyx_GOTREF(__pyx_t_16);
6313  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6314  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6315  __Pyx_GOTREF(__pyx_t_17);
6316  __pyx_t_15 = NULL;
6317  __pyx_t_18 = 0;
6318  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
6319  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
6320  if (likely(__pyx_t_15)) {
6321  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
6322  __Pyx_INCREF(__pyx_t_15);
6323  __Pyx_INCREF(function);
6324  __Pyx_DECREF_SET(__pyx_t_14, function);
6325  __pyx_t_18 = 1;
6326  }
6327  }
6328  #if CYTHON_FAST_PYCALL
6329  if (PyFunction_Check(__pyx_t_14)) {
6330  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_17};
6331  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6332  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
6333  __Pyx_GOTREF(__pyx_t_12);
6334  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6335  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6336  } else
6337  #endif
6338  #if CYTHON_FAST_PYCCALL
6339  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
6340  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_17};
6341  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6342  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
6343  __Pyx_GOTREF(__pyx_t_12);
6344  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6345  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6346  } else
6347  #endif
6348  {
6349  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6350  __Pyx_GOTREF(__pyx_t_13);
6351  if (__pyx_t_15) {
6352  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
6353  }
6354  __Pyx_GIVEREF(__pyx_t_16);
6355  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_16);
6356  __Pyx_GIVEREF(__pyx_t_17);
6357  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_17);
6358  __pyx_t_16 = 0;
6359  __pyx_t_17 = 0;
6360  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6361  __Pyx_GOTREF(__pyx_t_12);
6362  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6363  }
6364  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6365 
6366  /* "subsurfaceTransportFunctions.pyx":217
6367  * for k in range(x.shape[2]):
6368  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6369  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
6370  *
6371  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
6372  */
6373  if (unlikely(__pyx_v_material_functions == Py_None)) {
6374  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6375  __PYX_ERR(0, 217, __pyx_L1_error)
6376  }
6377  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6378  __Pyx_GOTREF(__pyx_t_13);
6379  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6380  __Pyx_GOTREF(__pyx_t_17);
6381  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6382  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6383  __Pyx_GOTREF(__pyx_t_13);
6384  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 217, __pyx_L1_error)
6385  __Pyx_GOTREF(__pyx_t_16);
6386  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6387  __Pyx_GOTREF(__pyx_t_15);
6388  __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6389  __Pyx_GOTREF(__pyx_t_19);
6390  __Pyx_GIVEREF(__pyx_t_13);
6391  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_13);
6392  __Pyx_GIVEREF(__pyx_t_16);
6393  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_16);
6394  __Pyx_GIVEREF(__pyx_t_15);
6395  PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_15);
6396  __pyx_t_13 = 0;
6397  __pyx_t_16 = 0;
6398  __pyx_t_15 = 0;
6399  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6400  __Pyx_GOTREF(__pyx_t_15);
6401  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6402  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6403  __Pyx_GOTREF(__pyx_t_19);
6404  __pyx_t_16 = NULL;
6405  __pyx_t_18 = 0;
6406  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
6407  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
6408  if (likely(__pyx_t_16)) {
6409  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
6410  __Pyx_INCREF(__pyx_t_16);
6411  __Pyx_INCREF(function);
6412  __Pyx_DECREF_SET(__pyx_t_17, function);
6413  __pyx_t_18 = 1;
6414  }
6415  }
6416  #if CYTHON_FAST_PYCALL
6417  if (PyFunction_Check(__pyx_t_17)) {
6418  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_19};
6419  __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6420  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
6421  __Pyx_GOTREF(__pyx_t_14);
6422  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6423  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6424  } else
6425  #endif
6426  #if CYTHON_FAST_PYCCALL
6427  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
6428  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_19};
6429  __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6430  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
6431  __Pyx_GOTREF(__pyx_t_14);
6432  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6433  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6434  } else
6435  #endif
6436  {
6437  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6438  __Pyx_GOTREF(__pyx_t_13);
6439  if (__pyx_t_16) {
6440  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_16); __pyx_t_16 = NULL;
6441  }
6442  __Pyx_GIVEREF(__pyx_t_15);
6443  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_15);
6444  __Pyx_GIVEREF(__pyx_t_19);
6445  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_19);
6446  __pyx_t_15 = 0;
6447  __pyx_t_19 = 0;
6448  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6449  __Pyx_GOTREF(__pyx_t_14);
6450  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6451  }
6452  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6453 
6454  /* "subsurfaceTransportFunctions.pyx":216
6455  * material_right= elementBoundaryTypes[ebN,1]
6456  * for k in range(x.shape[2]):
6457  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6458  * material_functions[material_right](x[eN,ebN_local,k],t))
6459  *
6460  */
6461  __pyx_t_17 = PyNumber_Add(__pyx_t_12, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6462  __Pyx_GOTREF(__pyx_t_17);
6463  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6464  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6465  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
6466  __Pyx_GOTREF(__pyx_t_14);
6467  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6468  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
6469  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6470  __pyx_t_8 = __pyx_v_eN;
6471  __pyx_t_7 = __pyx_v_ebN_local;
6472  __pyx_t_21 = __pyx_v_k;
6473  __pyx_t_18 = -1;
6474  if (__pyx_t_8 < 0) {
6475  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6476  if (unlikely(__pyx_t_8 < 0)) __pyx_t_18 = 0;
6477  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_18 = 0;
6478  if (__pyx_t_7 < 0) {
6479  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6480  if (unlikely(__pyx_t_7 < 0)) __pyx_t_18 = 1;
6481  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_18 = 1;
6482  if (__pyx_t_21 < 0) {
6483  __pyx_t_21 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6484  if (unlikely(__pyx_t_21 < 0)) __pyx_t_18 = 2;
6485  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_18 = 2;
6486  if (unlikely(__pyx_t_18 != -1)) {
6487  __Pyx_RaiseBufferIndexError(__pyx_t_18);
6488  __PYX_ERR(0, 216, __pyx_L1_error)
6489  }
6490  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_20;
6491  }
6492  }
6493  }
6494 
6495  /* "subsurfaceTransportFunctions.pyx":195
6496  *
6497  *
6498  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6499  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6500  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6501  */
6502 
6503  /* function exit code */
6504  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6505  goto __pyx_L0;
6506  __pyx_L1_error:;
6507  __Pyx_XDECREF(__pyx_t_12);
6508  __Pyx_XDECREF(__pyx_t_13);
6509  __Pyx_XDECREF(__pyx_t_14);
6510  __Pyx_XDECREF(__pyx_t_15);
6511  __Pyx_XDECREF(__pyx_t_16);
6512  __Pyx_XDECREF(__pyx_t_17);
6513  __Pyx_XDECREF(__pyx_t_19);
6514  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6515  __Pyx_PyThreadState_declare
6516  __Pyx_PyThreadState_assign
6517  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6518  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6519  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6520  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6521  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6522  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6523  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6524  __pyx_r = NULL;
6525  goto __pyx_L2;
6526  __pyx_L0:;
6527  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6528  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6529  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6530  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6531  __pyx_L2:;
6532  __Pyx_XGIVEREF(__pyx_r);
6533  __Pyx_RefNannyFinishContext();
6534  return __pyx_r;
6535 }
6536 
6537 /* "subsurfaceTransportFunctions.pyx":219
6538  * material_functions[material_right](x[eN,ebN_local,k],t))
6539  *
6540  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6541  * double t,
6542  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6543  */
6544 
6545 /* Python wrapper */
6546 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6547 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6548 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
6549 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6550  int __pyx_v_nd;
6551  double __pyx_v_t;
6552  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6553  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6554  PyArrayObject *__pyx_v_x = 0;
6555  PyArrayObject *__pyx_v_ebq_vals = 0;
6556  PyObject *__pyx_v_material_functions = 0;
6557  int __pyx_lineno = 0;
6558  const char *__pyx_filename = NULL;
6559  int __pyx_clineno = 0;
6560  PyObject *__pyx_r = 0;
6561  __Pyx_RefNannyDeclarations
6562  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
6563  {
6564  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
6565  PyObject* values[7] = {0,0,0,0,0,0,0};
6566  if (unlikely(__pyx_kwds)) {
6567  Py_ssize_t kw_args;
6568  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6569  switch (pos_args) {
6570  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6571  CYTHON_FALLTHROUGH;
6572  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6573  CYTHON_FALLTHROUGH;
6574  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6575  CYTHON_FALLTHROUGH;
6576  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6577  CYTHON_FALLTHROUGH;
6578  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6579  CYTHON_FALLTHROUGH;
6580  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6581  CYTHON_FALLTHROUGH;
6582  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6583  CYTHON_FALLTHROUGH;
6584  case 0: break;
6585  default: goto __pyx_L5_argtuple_error;
6586  }
6587  kw_args = PyDict_Size(__pyx_kwds);
6588  switch (pos_args) {
6589  case 0:
6590  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
6591  else goto __pyx_L5_argtuple_error;
6592  CYTHON_FALLTHROUGH;
6593  case 1:
6594  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6595  else {
6596  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 219, __pyx_L3_error)
6597  }
6598  CYTHON_FALLTHROUGH;
6599  case 2:
6600  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6601  else {
6602  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 219, __pyx_L3_error)
6603  }
6604  CYTHON_FALLTHROUGH;
6605  case 3:
6606  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6607  else {
6608  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 219, __pyx_L3_error)
6609  }
6610  CYTHON_FALLTHROUGH;
6611  case 4:
6612  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6613  else {
6614  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 219, __pyx_L3_error)
6615  }
6616  CYTHON_FALLTHROUGH;
6617  case 5:
6618  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6619  else {
6620  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 219, __pyx_L3_error)
6621  }
6622  CYTHON_FALLTHROUGH;
6623  case 6:
6624  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6625  else {
6626  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 219, __pyx_L3_error)
6627  }
6628  }
6629  if (unlikely(kw_args > 0)) {
6630  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6631  }
6632  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
6633  goto __pyx_L5_argtuple_error;
6634  } else {
6635  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6636  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6637  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6638  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6639  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6640  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6641  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6642  }
6643  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
6644  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
6645  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
6646  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
6647  __pyx_v_x = ((PyArrayObject *)values[4]);
6648  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
6649  __pyx_v_material_functions = ((PyObject*)values[6]);
6650  }
6651  goto __pyx_L4_argument_unpacking_done;
6652  __pyx_L5_argtuple_error:;
6653  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6654  __pyx_L3_error:;
6655  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6656  __Pyx_RefNannyFinishContext();
6657  return NULL;
6658  __pyx_L4_argument_unpacking_done:;
6659  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
6660  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
6661  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
6662  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 224, __pyx_L1_error)
6663  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 225, __pyx_L1_error)
6664  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6665 
6666  /* function exit code */
6667  goto __pyx_L0;
6668  __pyx_L1_error:;
6669  __pyx_r = NULL;
6670  __pyx_L0:;
6671  __Pyx_RefNannyFinishContext();
6672  return __pyx_r;
6673 }
6674 
6675 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6676  int __pyx_v_eN;
6677  int __pyx_v_ebN;
6678  int __pyx_v_ebN_local;
6679  int __pyx_v_k;
6680  int __pyx_v_material_left;
6681  int __pyx_v_material_right;
6682  int __pyx_v_I;
6683  int __pyx_v_J;
6684  double __pyx_v_numer;
6685  double __pyx_v_denom;
6686  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6687  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6688  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6689  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6690  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6691  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6692  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6693  __Pyx_Buffer __pyx_pybuffer_x;
6694  PyObject *__pyx_r = NULL;
6695  __Pyx_RefNannyDeclarations
6696  npy_intp __pyx_t_1;
6697  npy_intp __pyx_t_2;
6698  int __pyx_t_3;
6699  npy_intp __pyx_t_4;
6700  npy_intp __pyx_t_5;
6701  int __pyx_t_6;
6702  Py_ssize_t __pyx_t_7;
6703  Py_ssize_t __pyx_t_8;
6704  int __pyx_t_9;
6705  npy_intp __pyx_t_10;
6706  npy_intp __pyx_t_11;
6707  int __pyx_t_12;
6708  int __pyx_t_13;
6709  int __pyx_t_14;
6710  int __pyx_t_15;
6711  int __pyx_t_16;
6712  int __pyx_t_17;
6713  PyObject *__pyx_t_18 = NULL;
6714  PyObject *__pyx_t_19 = NULL;
6715  PyObject *__pyx_t_20 = NULL;
6716  PyObject *__pyx_t_21 = NULL;
6717  PyObject *__pyx_t_22 = NULL;
6718  PyObject *__pyx_t_23 = NULL;
6719  int __pyx_t_24;
6720  PyObject *__pyx_t_25 = NULL;
6721  double __pyx_t_26;
6722  Py_ssize_t __pyx_t_27;
6723  Py_ssize_t __pyx_t_28;
6724  int __pyx_lineno = 0;
6725  const char *__pyx_filename = NULL;
6726  int __pyx_clineno = 0;
6727  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
6728  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6729  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6730  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6731  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6732  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6733  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6734  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6735  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6736  __pyx_pybuffer_x.pybuffer.buf = NULL;
6737  __pyx_pybuffer_x.refcount = 0;
6738  __pyx_pybuffernd_x.data = NULL;
6739  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6740  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6741  __pyx_pybuffer_ebq_vals.refcount = 0;
6742  __pyx_pybuffernd_ebq_vals.data = NULL;
6743  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6744  {
6745  __Pyx_BufFmt_StackElem __pyx_stack[1];
6746  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6747  }
6748  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6749  {
6750  __Pyx_BufFmt_StackElem __pyx_stack[1];
6751  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6752  }
6753  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6754  {
6755  __Pyx_BufFmt_StackElem __pyx_stack[1];
6756  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6757  }
6758  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6759  {
6760  __Pyx_BufFmt_StackElem __pyx_stack[1];
6761  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6762  }
6763  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
6764 
6765  /* "subsurfaceTransportFunctions.pyx":236
6766  * cdef double numer,denom
6767  *
6768  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6769  * for ebN_local in range(x.shape[1]):
6770  * ebN = elementBoundariesArray[eN,ebN_local]
6771  */
6772  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6773  __pyx_t_2 = __pyx_t_1;
6774  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6775  __pyx_v_eN = __pyx_t_3;
6776 
6777  /* "subsurfaceTransportFunctions.pyx":237
6778  *
6779  * for eN in range(x.shape[0]):
6780  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6781  * ebN = elementBoundariesArray[eN,ebN_local]
6782  * material_left = elementBoundaryTypes[ebN,0]
6783  */
6784  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6785  __pyx_t_5 = __pyx_t_4;
6786  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6787  __pyx_v_ebN_local = __pyx_t_6;
6788 
6789  /* "subsurfaceTransportFunctions.pyx":238
6790  * for eN in range(x.shape[0]):
6791  * for ebN_local in range(x.shape[1]):
6792  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6793  * material_left = elementBoundaryTypes[ebN,0]
6794  * material_right= elementBoundaryTypes[ebN,1]
6795  */
6796  __pyx_t_7 = __pyx_v_eN;
6797  __pyx_t_8 = __pyx_v_ebN_local;
6798  __pyx_t_9 = -1;
6799  if (__pyx_t_7 < 0) {
6800  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6801  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6802  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6803  if (__pyx_t_8 < 0) {
6804  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6805  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6806  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6807  if (unlikely(__pyx_t_9 != -1)) {
6808  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6809  __PYX_ERR(0, 238, __pyx_L1_error)
6810  }
6811  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6812 
6813  /* "subsurfaceTransportFunctions.pyx":239
6814  * for ebN_local in range(x.shape[1]):
6815  * ebN = elementBoundariesArray[eN,ebN_local]
6816  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6817  * material_right= elementBoundaryTypes[ebN,1]
6818  * for k in range(x.shape[2]):
6819  */
6820  __pyx_t_8 = __pyx_v_ebN;
6821  __pyx_t_7 = 0;
6822  __pyx_t_9 = -1;
6823  if (__pyx_t_8 < 0) {
6824  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6825  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
6826  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6827  if (__pyx_t_7 < 0) {
6828  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6829  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
6830  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6831  if (unlikely(__pyx_t_9 != -1)) {
6832  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6833  __PYX_ERR(0, 239, __pyx_L1_error)
6834  }
6835  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6836 
6837  /* "subsurfaceTransportFunctions.pyx":240
6838  * ebN = elementBoundariesArray[eN,ebN_local]
6839  * material_left = elementBoundaryTypes[ebN,0]
6840  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6841  * for k in range(x.shape[2]):
6842  * for I in range(nd):
6843  */
6844  __pyx_t_7 = __pyx_v_ebN;
6845  __pyx_t_8 = 1;
6846  __pyx_t_9 = -1;
6847  if (__pyx_t_7 < 0) {
6848  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6849  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6850  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6851  if (__pyx_t_8 < 0) {
6852  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6853  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6854  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6855  if (unlikely(__pyx_t_9 != -1)) {
6856  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6857  __PYX_ERR(0, 240, __pyx_L1_error)
6858  }
6859  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6860 
6861  /* "subsurfaceTransportFunctions.pyx":241
6862  * material_left = elementBoundaryTypes[ebN,0]
6863  * material_right= elementBoundaryTypes[ebN,1]
6864  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6865  * for I in range(nd):
6866  * for J in range(nd):
6867  */
6868  __pyx_t_10 = (__pyx_v_x->dimensions[2]);
6869  __pyx_t_11 = __pyx_t_10;
6870  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
6871  __pyx_v_k = __pyx_t_9;
6872 
6873  /* "subsurfaceTransportFunctions.pyx":242
6874  * material_right= elementBoundaryTypes[ebN,1]
6875  * for k in range(x.shape[2]):
6876  * for I in range(nd): # <<<<<<<<<<<<<<
6877  * for J in range(nd):
6878  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6879  */
6880  __pyx_t_12 = __pyx_v_nd;
6881  __pyx_t_13 = __pyx_t_12;
6882  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6883  __pyx_v_I = __pyx_t_14;
6884 
6885  /* "subsurfaceTransportFunctions.pyx":243
6886  * for k in range(x.shape[2]):
6887  * for I in range(nd):
6888  * for J in range(nd): # <<<<<<<<<<<<<<
6889  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6890  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6891  */
6892  __pyx_t_15 = __pyx_v_nd;
6893  __pyx_t_16 = __pyx_t_15;
6894  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
6895  __pyx_v_J = __pyx_t_17;
6896 
6897  /* "subsurfaceTransportFunctions.pyx":244
6898  * for I in range(nd):
6899  * for J in range(nd):
6900  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6901  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6902  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6903  */
6904  if (unlikely(__pyx_v_material_functions == Py_None)) {
6905  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6906  __PYX_ERR(0, 244, __pyx_L1_error)
6907  }
6908  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6909  __Pyx_GOTREF(__pyx_t_19);
6910  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6911  __Pyx_GOTREF(__pyx_t_20);
6912  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6913  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6914  __Pyx_GOTREF(__pyx_t_19);
6915  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
6916  __Pyx_GOTREF(__pyx_t_21);
6917  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6918  __Pyx_GOTREF(__pyx_t_22);
6919  __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6920  __Pyx_GOTREF(__pyx_t_23);
6921  __Pyx_GIVEREF(__pyx_t_19);
6922  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_19);
6923  __Pyx_GIVEREF(__pyx_t_21);
6924  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
6925  __Pyx_GIVEREF(__pyx_t_22);
6926  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
6927  __pyx_t_19 = 0;
6928  __pyx_t_21 = 0;
6929  __pyx_t_22 = 0;
6930  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6931  __Pyx_GOTREF(__pyx_t_22);
6932  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6933  __pyx_t_23 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6934  __Pyx_GOTREF(__pyx_t_23);
6935  __pyx_t_21 = NULL;
6936  __pyx_t_24 = 0;
6937  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
6938  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20);
6939  if (likely(__pyx_t_21)) {
6940  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
6941  __Pyx_INCREF(__pyx_t_21);
6942  __Pyx_INCREF(function);
6943  __Pyx_DECREF_SET(__pyx_t_20, function);
6944  __pyx_t_24 = 1;
6945  }
6946  }
6947  #if CYTHON_FAST_PYCALL
6948  if (PyFunction_Check(__pyx_t_20)) {
6949  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_22, __pyx_t_23};
6950  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6951  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6952  __Pyx_GOTREF(__pyx_t_18);
6953  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6954  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6955  } else
6956  #endif
6957  #if CYTHON_FAST_PYCCALL
6958  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
6959  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_22, __pyx_t_23};
6960  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6961  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6962  __Pyx_GOTREF(__pyx_t_18);
6963  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6964  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6965  } else
6966  #endif
6967  {
6968  __pyx_t_19 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6969  __Pyx_GOTREF(__pyx_t_19);
6970  if (__pyx_t_21) {
6971  __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21); __pyx_t_21 = NULL;
6972  }
6973  __Pyx_GIVEREF(__pyx_t_22);
6974  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_24, __pyx_t_22);
6975  __Pyx_GIVEREF(__pyx_t_23);
6976  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_24, __pyx_t_23);
6977  __pyx_t_22 = 0;
6978  __pyx_t_23 = 0;
6979  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_19, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6980  __Pyx_GOTREF(__pyx_t_18);
6981  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6982  }
6983  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6984  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6985  __Pyx_GOTREF(__pyx_t_20);
6986  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6987  __Pyx_GOTREF(__pyx_t_19);
6988  __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6989  __Pyx_GOTREF(__pyx_t_23);
6990  __Pyx_GIVEREF(__pyx_t_20);
6991  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
6992  __Pyx_GIVEREF(__pyx_t_19);
6993  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_19);
6994  __pyx_t_20 = 0;
6995  __pyx_t_19 = 0;
6996  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_23); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6997  __Pyx_GOTREF(__pyx_t_19);
6998  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6999  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7000  __pyx_t_23 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7001  __Pyx_GOTREF(__pyx_t_23);
7002  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7003  if (unlikely(__pyx_v_material_functions == Py_None)) {
7004  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7005  __PYX_ERR(0, 244, __pyx_L1_error)
7006  }
7007  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7008  __Pyx_GOTREF(__pyx_t_18);
7009  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7010  __Pyx_GOTREF(__pyx_t_20);
7011  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7012  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7013  __Pyx_GOTREF(__pyx_t_18);
7014  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7015  __Pyx_GOTREF(__pyx_t_22);
7016  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7017  __Pyx_GOTREF(__pyx_t_21);
7018  __pyx_t_25 = PyTuple_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7019  __Pyx_GOTREF(__pyx_t_25);
7020  __Pyx_GIVEREF(__pyx_t_18);
7021  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_18);
7022  __Pyx_GIVEREF(__pyx_t_22);
7023  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_22);
7024  __Pyx_GIVEREF(__pyx_t_21);
7025  PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_t_21);
7026  __pyx_t_18 = 0;
7027  __pyx_t_22 = 0;
7028  __pyx_t_21 = 0;
7029  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7030  __Pyx_GOTREF(__pyx_t_21);
7031  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7032  __pyx_t_25 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7033  __Pyx_GOTREF(__pyx_t_25);
7034  __pyx_t_22 = NULL;
7035  __pyx_t_24 = 0;
7036  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
7037  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
7038  if (likely(__pyx_t_22)) {
7039  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
7040  __Pyx_INCREF(__pyx_t_22);
7041  __Pyx_INCREF(function);
7042  __Pyx_DECREF_SET(__pyx_t_20, function);
7043  __pyx_t_24 = 1;
7044  }
7045  }
7046  #if CYTHON_FAST_PYCALL
7047  if (PyFunction_Check(__pyx_t_20)) {
7048  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_25};
7049  __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7050  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
7051  __Pyx_GOTREF(__pyx_t_19);
7052  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7053  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7054  } else
7055  #endif
7056  #if CYTHON_FAST_PYCCALL
7057  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
7058  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_25};
7059  __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7060  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
7061  __Pyx_GOTREF(__pyx_t_19);
7062  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7063  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7064  } else
7065  #endif
7066  {
7067  __pyx_t_18 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7068  __Pyx_GOTREF(__pyx_t_18);
7069  if (__pyx_t_22) {
7070  __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_22); __pyx_t_22 = NULL;
7071  }
7072  __Pyx_GIVEREF(__pyx_t_21);
7073  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_24, __pyx_t_21);
7074  __Pyx_GIVEREF(__pyx_t_25);
7075  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_24, __pyx_t_25);
7076  __pyx_t_21 = 0;
7077  __pyx_t_25 = 0;
7078  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_18, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7079  __Pyx_GOTREF(__pyx_t_19);
7080  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7081  }
7082  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7083  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7084  __Pyx_GOTREF(__pyx_t_20);
7085  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7086  __Pyx_GOTREF(__pyx_t_18);
7087  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7088  __Pyx_GOTREF(__pyx_t_25);
7089  __Pyx_GIVEREF(__pyx_t_20);
7090  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_20);
7091  __Pyx_GIVEREF(__pyx_t_18);
7092  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_18);
7093  __pyx_t_20 = 0;
7094  __pyx_t_18 = 0;
7095  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_25); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7096  __Pyx_GOTREF(__pyx_t_18);
7097  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7098  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7099  __pyx_t_25 = PyNumber_Multiply(__pyx_t_23, __pyx_t_18); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7100  __Pyx_GOTREF(__pyx_t_25);
7101  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7102  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7103  __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_25); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
7104  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7105  __pyx_v_numer = __pyx_t_26;
7106 
7107  /* "subsurfaceTransportFunctions.pyx":245
7108  * for J in range(nd):
7109  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7110  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
7111  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7112  *
7113  */
7114  if (unlikely(__pyx_v_material_functions == Py_None)) {
7115  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7116  __PYX_ERR(0, 245, __pyx_L1_error)
7117  }
7118  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7119  __Pyx_GOTREF(__pyx_t_18);
7120  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7121  __Pyx_GOTREF(__pyx_t_23);
7122  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7123  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7124  __Pyx_GOTREF(__pyx_t_18);
7125  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7126  __Pyx_GOTREF(__pyx_t_19);
7127  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7128  __Pyx_GOTREF(__pyx_t_20);
7129  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7130  __Pyx_GOTREF(__pyx_t_21);
7131  __Pyx_GIVEREF(__pyx_t_18);
7132  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
7133  __Pyx_GIVEREF(__pyx_t_19);
7134  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
7135  __Pyx_GIVEREF(__pyx_t_20);
7136  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_20);
7137  __pyx_t_18 = 0;
7138  __pyx_t_19 = 0;
7139  __pyx_t_20 = 0;
7140  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7141  __Pyx_GOTREF(__pyx_t_20);
7142  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7143  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7144  __Pyx_GOTREF(__pyx_t_21);
7145  __pyx_t_19 = NULL;
7146  __pyx_t_24 = 0;
7147  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
7148  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_23);
7149  if (likely(__pyx_t_19)) {
7150  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
7151  __Pyx_INCREF(__pyx_t_19);
7152  __Pyx_INCREF(function);
7153  __Pyx_DECREF_SET(__pyx_t_23, function);
7154  __pyx_t_24 = 1;
7155  }
7156  }
7157  #if CYTHON_FAST_PYCALL
7158  if (PyFunction_Check(__pyx_t_23)) {
7159  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
7160  __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7161  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7162  __Pyx_GOTREF(__pyx_t_25);
7163  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7164  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7165  } else
7166  #endif
7167  #if CYTHON_FAST_PYCCALL
7168  if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
7169  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
7170  __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7171  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7172  __Pyx_GOTREF(__pyx_t_25);
7173  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7174  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7175  } else
7176  #endif
7177  {
7178  __pyx_t_18 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7179  __Pyx_GOTREF(__pyx_t_18);
7180  if (__pyx_t_19) {
7181  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19); __pyx_t_19 = NULL;
7182  }
7183  __Pyx_GIVEREF(__pyx_t_20);
7184  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_24, __pyx_t_20);
7185  __Pyx_GIVEREF(__pyx_t_21);
7186  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_24, __pyx_t_21);
7187  __pyx_t_20 = 0;
7188  __pyx_t_21 = 0;
7189  __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_18, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7190  __Pyx_GOTREF(__pyx_t_25);
7191  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7192  }
7193  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7194  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7195  __Pyx_GOTREF(__pyx_t_23);
7196  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7197  __Pyx_GOTREF(__pyx_t_18);
7198  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7199  __Pyx_GOTREF(__pyx_t_21);
7200  __Pyx_GIVEREF(__pyx_t_23);
7201  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_23);
7202  __Pyx_GIVEREF(__pyx_t_18);
7203  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_18);
7204  __pyx_t_23 = 0;
7205  __pyx_t_18 = 0;
7206  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_t_21); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7207  __Pyx_GOTREF(__pyx_t_18);
7208  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7209  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7210  if (unlikely(__pyx_v_material_functions == Py_None)) {
7211  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7212  __PYX_ERR(0, 245, __pyx_L1_error)
7213  }
7214  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7215  __Pyx_GOTREF(__pyx_t_25);
7216  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_25); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7217  __Pyx_GOTREF(__pyx_t_23);
7218  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7219  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7220  __Pyx_GOTREF(__pyx_t_25);
7221  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7222  __Pyx_GOTREF(__pyx_t_20);
7223  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7224  __Pyx_GOTREF(__pyx_t_19);
7225  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7226  __Pyx_GOTREF(__pyx_t_22);
7227  __Pyx_GIVEREF(__pyx_t_25);
7228  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_25);
7229  __Pyx_GIVEREF(__pyx_t_20);
7230  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
7231  __Pyx_GIVEREF(__pyx_t_19);
7232  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_19);
7233  __pyx_t_25 = 0;
7234  __pyx_t_20 = 0;
7235  __pyx_t_19 = 0;
7236  __pyx_t_19 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7237  __Pyx_GOTREF(__pyx_t_19);
7238  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7239  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7240  __Pyx_GOTREF(__pyx_t_22);
7241  __pyx_t_20 = NULL;
7242  __pyx_t_24 = 0;
7243  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
7244  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_23);
7245  if (likely(__pyx_t_20)) {
7246  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
7247  __Pyx_INCREF(__pyx_t_20);
7248  __Pyx_INCREF(function);
7249  __Pyx_DECREF_SET(__pyx_t_23, function);
7250  __pyx_t_24 = 1;
7251  }
7252  }
7253  #if CYTHON_FAST_PYCALL
7254  if (PyFunction_Check(__pyx_t_23)) {
7255  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_22};
7256  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7257  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7258  __Pyx_GOTREF(__pyx_t_21);
7259  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7260  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7261  } else
7262  #endif
7263  #if CYTHON_FAST_PYCCALL
7264  if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
7265  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_22};
7266  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7267  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7268  __Pyx_GOTREF(__pyx_t_21);
7269  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7270  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7271  } else
7272  #endif
7273  {
7274  __pyx_t_25 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7275  __Pyx_GOTREF(__pyx_t_25);
7276  if (__pyx_t_20) {
7277  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_20); __pyx_t_20 = NULL;
7278  }
7279  __Pyx_GIVEREF(__pyx_t_19);
7280  PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_24, __pyx_t_19);
7281  __Pyx_GIVEREF(__pyx_t_22);
7282  PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_24, __pyx_t_22);
7283  __pyx_t_19 = 0;
7284  __pyx_t_22 = 0;
7285  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_25, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7286  __Pyx_GOTREF(__pyx_t_21);
7287  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7288  }
7289  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7290  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7291  __Pyx_GOTREF(__pyx_t_23);
7292  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7293  __Pyx_GOTREF(__pyx_t_25);
7294  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7295  __Pyx_GOTREF(__pyx_t_22);
7296  __Pyx_GIVEREF(__pyx_t_23);
7297  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23);
7298  __Pyx_GIVEREF(__pyx_t_25);
7299  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_25);
7300  __pyx_t_23 = 0;
7301  __pyx_t_25 = 0;
7302  __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7303  __Pyx_GOTREF(__pyx_t_25);
7304  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7305  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7306  __pyx_t_22 = PyNumber_Add(__pyx_t_18, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7307  __Pyx_GOTREF(__pyx_t_22);
7308  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7309  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7310  __pyx_t_25 = __Pyx_PyFloat_AddObjC(__pyx_t_22, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7311  __Pyx_GOTREF(__pyx_t_25);
7312  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7313  __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_25); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
7314  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7315  __pyx_v_denom = __pyx_t_26;
7316 
7317  /* "subsurfaceTransportFunctions.pyx":246
7318  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7319  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
7320  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
7321  *
7322  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
7323  */
7324  if (unlikely(__pyx_v_denom == 0)) {
7325  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
7326  __PYX_ERR(0, 246, __pyx_L1_error)
7327  }
7328  __pyx_t_8 = __pyx_v_eN;
7329  __pyx_t_7 = __pyx_v_ebN_local;
7330  __pyx_t_27 = __pyx_v_k;
7331  __pyx_t_28 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
7332  __pyx_t_24 = -1;
7333  if (__pyx_t_8 < 0) {
7334  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
7335  if (unlikely(__pyx_t_8 < 0)) __pyx_t_24 = 0;
7336  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_24 = 0;
7337  if (__pyx_t_7 < 0) {
7338  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
7339  if (unlikely(__pyx_t_7 < 0)) __pyx_t_24 = 1;
7340  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_24 = 1;
7341  if (__pyx_t_27 < 0) {
7342  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
7343  if (unlikely(__pyx_t_27 < 0)) __pyx_t_24 = 2;
7344  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_24 = 2;
7345  if (__pyx_t_28 < 0) {
7346  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
7347  if (unlikely(__pyx_t_28 < 0)) __pyx_t_24 = 3;
7348  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_24 = 3;
7349  if (unlikely(__pyx_t_24 != -1)) {
7350  __Pyx_RaiseBufferIndexError(__pyx_t_24);
7351  __PYX_ERR(0, 246, __pyx_L1_error)
7352  }
7353  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
7354  }
7355  }
7356  }
7357  }
7358  }
7359 
7360  /* "subsurfaceTransportFunctions.pyx":219
7361  * material_functions[material_right](x[eN,ebN_local,k],t))
7362  *
7363  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7364  * double t,
7365  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7366  */
7367 
7368  /* function exit code */
7369  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7370  goto __pyx_L0;
7371  __pyx_L1_error:;
7372  __Pyx_XDECREF(__pyx_t_18);
7373  __Pyx_XDECREF(__pyx_t_19);
7374  __Pyx_XDECREF(__pyx_t_20);
7375  __Pyx_XDECREF(__pyx_t_21);
7376  __Pyx_XDECREF(__pyx_t_22);
7377  __Pyx_XDECREF(__pyx_t_23);
7378  __Pyx_XDECREF(__pyx_t_25);
7379  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7380  __Pyx_PyThreadState_declare
7381  __Pyx_PyThreadState_assign
7382  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7383  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7384  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7385  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7386  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7387  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7388  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7389  __pyx_r = NULL;
7390  goto __pyx_L2;
7391  __pyx_L0:;
7392  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7393  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7394  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7395  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7396  __pyx_L2:;
7397  __Pyx_XGIVEREF(__pyx_r);
7398  __Pyx_RefNannyFinishContext();
7399  return __pyx_r;
7400 }
7401 
7402 /* "subsurfaceTransportFunctions.pyx":248
7403  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7404  *
7405  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7406  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7407  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7408  */
7409 
7410 /* Python wrapper */
7411 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7412 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7413 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
7414 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7415  double __pyx_v_t;
7416  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7417  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7418  PyArrayObject *__pyx_v_x = 0;
7419  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7420  PyObject *__pyx_v_material_functions = 0;
7421  int __pyx_lineno = 0;
7422  const char *__pyx_filename = NULL;
7423  int __pyx_clineno = 0;
7424  PyObject *__pyx_r = 0;
7425  __Pyx_RefNannyDeclarations
7426  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
7427  {
7428  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7429  PyObject* values[6] = {0,0,0,0,0,0};
7430  if (unlikely(__pyx_kwds)) {
7431  Py_ssize_t kw_args;
7432  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7433  switch (pos_args) {
7434  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7435  CYTHON_FALLTHROUGH;
7436  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7437  CYTHON_FALLTHROUGH;
7438  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7439  CYTHON_FALLTHROUGH;
7440  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7441  CYTHON_FALLTHROUGH;
7442  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7443  CYTHON_FALLTHROUGH;
7444  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7445  CYTHON_FALLTHROUGH;
7446  case 0: break;
7447  default: goto __pyx_L5_argtuple_error;
7448  }
7449  kw_args = PyDict_Size(__pyx_kwds);
7450  switch (pos_args) {
7451  case 0:
7452  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7453  else goto __pyx_L5_argtuple_error;
7454  CYTHON_FALLTHROUGH;
7455  case 1:
7456  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7457  else {
7458  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 248, __pyx_L3_error)
7459  }
7460  CYTHON_FALLTHROUGH;
7461  case 2:
7462  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7463  else {
7464  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 248, __pyx_L3_error)
7465  }
7466  CYTHON_FALLTHROUGH;
7467  case 3:
7468  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7469  else {
7470  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 248, __pyx_L3_error)
7471  }
7472  CYTHON_FALLTHROUGH;
7473  case 4:
7474  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7475  else {
7476  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 248, __pyx_L3_error)
7477  }
7478  CYTHON_FALLTHROUGH;
7479  case 5:
7480  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7481  else {
7482  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 248, __pyx_L3_error)
7483  }
7484  }
7485  if (unlikely(kw_args > 0)) {
7486  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
7487  }
7488  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
7489  goto __pyx_L5_argtuple_error;
7490  } else {
7491  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7492  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7493  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7494  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7495  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7496  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7497  }
7498  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
7499  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
7500  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
7501  __pyx_v_x = ((PyArrayObject *)values[3]);
7502  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
7503  __pyx_v_material_functions = ((PyObject*)values[5]);
7504  }
7505  goto __pyx_L4_argument_unpacking_done;
7506  __pyx_L5_argtuple_error:;
7507  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
7508  __pyx_L3_error:;
7509  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7510  __Pyx_RefNannyFinishContext();
7511  return NULL;
7512  __pyx_L4_argument_unpacking_done:;
7513  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 249, __pyx_L1_error)
7514  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 250, __pyx_L1_error)
7515  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 251, __pyx_L1_error)
7516  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 252, __pyx_L1_error)
7517  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 253, __pyx_L1_error)
7518  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7519 
7520  /* function exit code */
7521  goto __pyx_L0;
7522  __pyx_L1_error:;
7523  __pyx_r = NULL;
7524  __pyx_L0:;
7525  __Pyx_RefNannyFinishContext();
7526  return __pyx_r;
7527 }
7528 
7529 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7530  int __pyx_v_ebN;
7531  int __pyx_v_material_left;
7532  int __pyx_v_material_right;
7533  npy_intp __pyx_v_k;
7534  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7535  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7536  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7537  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7538  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7539  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7540  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7541  __Pyx_Buffer __pyx_pybuffer_x;
7542  PyObject *__pyx_r = NULL;
7543  __Pyx_RefNannyDeclarations
7544  npy_intp __pyx_t_1;
7545  npy_intp __pyx_t_2;
7546  int __pyx_t_3;
7547  Py_ssize_t __pyx_t_4;
7548  Py_ssize_t __pyx_t_5;
7549  int __pyx_t_6;
7550  npy_intp __pyx_t_7;
7551  npy_intp __pyx_t_8;
7552  npy_intp __pyx_t_9;
7553  PyObject *__pyx_t_10 = NULL;
7554  PyObject *__pyx_t_11 = NULL;
7555  PyObject *__pyx_t_12 = NULL;
7556  PyObject *__pyx_t_13 = NULL;
7557  PyObject *__pyx_t_14 = NULL;
7558  PyObject *__pyx_t_15 = NULL;
7559  PyObject *__pyx_t_16 = NULL;
7560  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
7561  int __pyx_lineno = 0;
7562  const char *__pyx_filename = NULL;
7563  int __pyx_clineno = 0;
7564  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
7565  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7566  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7567  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7568  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7569  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7570  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7571  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7572  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7573  __pyx_pybuffer_x.pybuffer.buf = NULL;
7574  __pyx_pybuffer_x.refcount = 0;
7575  __pyx_pybuffernd_x.data = NULL;
7576  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7577  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7578  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7579  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7580  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7581  {
7582  __Pyx_BufFmt_StackElem __pyx_stack[1];
7583  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7584  }
7585  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7586  {
7587  __Pyx_BufFmt_StackElem __pyx_stack[1];
7588  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7589  }
7590  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7591  {
7592  __Pyx_BufFmt_StackElem __pyx_stack[1];
7593  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7594  }
7595  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
7596  {
7597  __Pyx_BufFmt_StackElem __pyx_stack[1];
7598  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7599  }
7600  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
7601 
7602  /* "subsurfaceTransportFunctions.pyx":263
7603  * cdef int ebN,material_left,material_right
7604  *
7605  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7606  * material_left = elementBoundaryTypes[ebN,0]
7607  * material_right= elementBoundaryTypes[ebN,1]
7608  */
7609  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7610  __pyx_t_2 = __pyx_t_1;
7611  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7612  __pyx_v_ebN = __pyx_t_3;
7613 
7614  /* "subsurfaceTransportFunctions.pyx":264
7615  *
7616  * for ebN in range(x.shape[0]):
7617  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7618  * material_right= elementBoundaryTypes[ebN,1]
7619  * for k in range(x.shape[1]):
7620  */
7621  __pyx_t_4 = __pyx_v_ebN;
7622  __pyx_t_5 = 0;
7623  __pyx_t_6 = -1;
7624  if (__pyx_t_4 < 0) {
7625  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7626  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7627  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7628  if (__pyx_t_5 < 0) {
7629  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7630  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7631  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7632  if (unlikely(__pyx_t_6 != -1)) {
7633  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7634  __PYX_ERR(0, 264, __pyx_L1_error)
7635  }
7636  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7637 
7638  /* "subsurfaceTransportFunctions.pyx":265
7639  * for ebN in range(x.shape[0]):
7640  * material_left = elementBoundaryTypes[ebN,0]
7641  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7642  * for k in range(x.shape[1]):
7643  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7644  */
7645  __pyx_t_5 = __pyx_v_ebN;
7646  __pyx_t_4 = 1;
7647  __pyx_t_6 = -1;
7648  if (__pyx_t_5 < 0) {
7649  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7650  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
7651  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7652  if (__pyx_t_4 < 0) {
7653  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7654  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
7655  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7656  if (unlikely(__pyx_t_6 != -1)) {
7657  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7658  __PYX_ERR(0, 265, __pyx_L1_error)
7659  }
7660  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7661 
7662  /* "subsurfaceTransportFunctions.pyx":266
7663  * material_left = elementBoundaryTypes[ebN,0]
7664  * material_right= elementBoundaryTypes[ebN,1]
7665  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7666  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7667  * material_functions[material_right](x[ebN,k],t))
7668  */
7669  __pyx_t_7 = (__pyx_v_x->dimensions[1]);
7670  __pyx_t_8 = __pyx_t_7;
7671  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
7672  __pyx_v_k = __pyx_t_9;
7673 
7674  /* "subsurfaceTransportFunctions.pyx":267
7675  * material_right= elementBoundaryTypes[ebN,1]
7676  * for k in range(x.shape[1]):
7677  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7678  * material_functions[material_right](x[ebN,k],t))
7679  *
7680  */
7681  if (unlikely(__pyx_v_material_functions == Py_None)) {
7682  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7683  __PYX_ERR(0, 267, __pyx_L1_error)
7684  }
7685  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7686  __Pyx_GOTREF(__pyx_t_11);
7687  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7688  __Pyx_GOTREF(__pyx_t_12);
7689  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7690  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7691  __Pyx_GOTREF(__pyx_t_11);
7692  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7693  __Pyx_GOTREF(__pyx_t_13);
7694  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7695  __Pyx_GOTREF(__pyx_t_14);
7696  __Pyx_GIVEREF(__pyx_t_11);
7697  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11);
7698  __Pyx_GIVEREF(__pyx_t_13);
7699  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
7700  __pyx_t_11 = 0;
7701  __pyx_t_13 = 0;
7702  __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7703  __Pyx_GOTREF(__pyx_t_13);
7704  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7705  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7706  __Pyx_GOTREF(__pyx_t_14);
7707  __pyx_t_11 = NULL;
7708  __pyx_t_6 = 0;
7709  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
7710  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
7711  if (likely(__pyx_t_11)) {
7712  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
7713  __Pyx_INCREF(__pyx_t_11);
7714  __Pyx_INCREF(function);
7715  __Pyx_DECREF_SET(__pyx_t_12, function);
7716  __pyx_t_6 = 1;
7717  }
7718  }
7719  #if CYTHON_FAST_PYCALL
7720  if (PyFunction_Check(__pyx_t_12)) {
7721  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7722  __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7723  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7724  __Pyx_GOTREF(__pyx_t_10);
7725  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7726  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7727  } else
7728  #endif
7729  #if CYTHON_FAST_PYCCALL
7730  if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
7731  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7732  __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7733  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7734  __Pyx_GOTREF(__pyx_t_10);
7735  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7736  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7737  } else
7738  #endif
7739  {
7740  __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7741  __Pyx_GOTREF(__pyx_t_15);
7742  if (__pyx_t_11) {
7743  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
7744  }
7745  __Pyx_GIVEREF(__pyx_t_13);
7746  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_t_13);
7747  __Pyx_GIVEREF(__pyx_t_14);
7748  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_t_14);
7749  __pyx_t_13 = 0;
7750  __pyx_t_14 = 0;
7751  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7752  __Pyx_GOTREF(__pyx_t_10);
7753  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7754  }
7755  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7756 
7757  /* "subsurfaceTransportFunctions.pyx":268
7758  * for k in range(x.shape[1]):
7759  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7760  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
7761  *
7762  *
7763  */
7764  if (unlikely(__pyx_v_material_functions == Py_None)) {
7765  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7766  __PYX_ERR(0, 268, __pyx_L1_error)
7767  }
7768  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7769  __Pyx_GOTREF(__pyx_t_15);
7770  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7771  __Pyx_GOTREF(__pyx_t_14);
7772  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7773  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7774  __Pyx_GOTREF(__pyx_t_15);
7775  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7776  __Pyx_GOTREF(__pyx_t_13);
7777  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7778  __Pyx_GOTREF(__pyx_t_11);
7779  __Pyx_GIVEREF(__pyx_t_15);
7780  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15);
7781  __Pyx_GIVEREF(__pyx_t_13);
7782  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
7783  __pyx_t_15 = 0;
7784  __pyx_t_13 = 0;
7785  __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7786  __Pyx_GOTREF(__pyx_t_13);
7787  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7788  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7789  __Pyx_GOTREF(__pyx_t_11);
7790  __pyx_t_15 = NULL;
7791  __pyx_t_6 = 0;
7792  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7793  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
7794  if (likely(__pyx_t_15)) {
7795  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7796  __Pyx_INCREF(__pyx_t_15);
7797  __Pyx_INCREF(function);
7798  __Pyx_DECREF_SET(__pyx_t_14, function);
7799  __pyx_t_6 = 1;
7800  }
7801  }
7802  #if CYTHON_FAST_PYCALL
7803  if (PyFunction_Check(__pyx_t_14)) {
7804  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7805  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7806  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7807  __Pyx_GOTREF(__pyx_t_12);
7808  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7809  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7810  } else
7811  #endif
7812  #if CYTHON_FAST_PYCCALL
7813  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7814  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7815  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7816  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7817  __Pyx_GOTREF(__pyx_t_12);
7818  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7819  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7820  } else
7821  #endif
7822  {
7823  __pyx_t_16 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 268, __pyx_L1_error)
7824  __Pyx_GOTREF(__pyx_t_16);
7825  if (__pyx_t_15) {
7826  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
7827  }
7828  __Pyx_GIVEREF(__pyx_t_13);
7829  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_t_13);
7830  __Pyx_GIVEREF(__pyx_t_11);
7831  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_11);
7832  __pyx_t_13 = 0;
7833  __pyx_t_11 = 0;
7834  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7835  __Pyx_GOTREF(__pyx_t_12);
7836  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7837  }
7838  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7839 
7840  /* "subsurfaceTransportFunctions.pyx":267
7841  * material_right= elementBoundaryTypes[ebN,1]
7842  * for k in range(x.shape[1]):
7843  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7844  * material_functions[material_right](x[ebN,k],t))
7845  *
7846  */
7847  __pyx_t_14 = PyNumber_Add(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7848  __Pyx_GOTREF(__pyx_t_14);
7849  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7850  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7851  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7852  __Pyx_GOTREF(__pyx_t_12);
7853  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7854  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
7855  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7856  __pyx_t_4 = __pyx_v_ebN;
7857  __pyx_t_5 = __pyx_v_k;
7858  __pyx_t_6 = -1;
7859  if (__pyx_t_4 < 0) {
7860  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7861  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7862  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
7863  if (__pyx_t_5 < 0) {
7864  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7865  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7866  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
7867  if (unlikely(__pyx_t_6 != -1)) {
7868  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7869  __PYX_ERR(0, 267, __pyx_L1_error)
7870  }
7871  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_17;
7872  }
7873  }
7874 
7875  /* "subsurfaceTransportFunctions.pyx":248
7876  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7877  *
7878  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7879  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7880  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7881  */
7882 
7883  /* function exit code */
7884  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7885  goto __pyx_L0;
7886  __pyx_L1_error:;
7887  __Pyx_XDECREF(__pyx_t_10);
7888  __Pyx_XDECREF(__pyx_t_11);
7889  __Pyx_XDECREF(__pyx_t_12);
7890  __Pyx_XDECREF(__pyx_t_13);
7891  __Pyx_XDECREF(__pyx_t_14);
7892  __Pyx_XDECREF(__pyx_t_15);
7893  __Pyx_XDECREF(__pyx_t_16);
7894  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7895  __Pyx_PyThreadState_declare
7896  __Pyx_PyThreadState_assign
7897  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7898  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7899  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7900  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7901  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7902  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7903  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7904  __pyx_r = NULL;
7905  goto __pyx_L2;
7906  __pyx_L0:;
7907  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7908  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7909  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7910  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7911  __pyx_L2:;
7912  __Pyx_XGIVEREF(__pyx_r);
7913  __Pyx_RefNannyFinishContext();
7914  return __pyx_r;
7915 }
7916 
7917 /* "subsurfaceTransportFunctions.pyx":271
7918  *
7919  *
7920  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7921  * double t,
7922  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7923  */
7924 
7925 /* Python wrapper */
7926 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7927 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7928 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
7929 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7930  int __pyx_v_nd;
7931  double __pyx_v_t;
7932  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7933  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7934  PyArrayObject *__pyx_v_x = 0;
7935  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7936  PyObject *__pyx_v_material_functions = 0;
7937  int __pyx_lineno = 0;
7938  const char *__pyx_filename = NULL;
7939  int __pyx_clineno = 0;
7940  PyObject *__pyx_r = 0;
7941  __Pyx_RefNannyDeclarations
7942  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
7943  {
7944  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7945  PyObject* values[7] = {0,0,0,0,0,0,0};
7946  if (unlikely(__pyx_kwds)) {
7947  Py_ssize_t kw_args;
7948  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7949  switch (pos_args) {
7950  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7951  CYTHON_FALLTHROUGH;
7952  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7953  CYTHON_FALLTHROUGH;
7954  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7955  CYTHON_FALLTHROUGH;
7956  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7957  CYTHON_FALLTHROUGH;
7958  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7959  CYTHON_FALLTHROUGH;
7960  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7961  CYTHON_FALLTHROUGH;
7962  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7963  CYTHON_FALLTHROUGH;
7964  case 0: break;
7965  default: goto __pyx_L5_argtuple_error;
7966  }
7967  kw_args = PyDict_Size(__pyx_kwds);
7968  switch (pos_args) {
7969  case 0:
7970  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
7971  else goto __pyx_L5_argtuple_error;
7972  CYTHON_FALLTHROUGH;
7973  case 1:
7974  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7975  else {
7976  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 271, __pyx_L3_error)
7977  }
7978  CYTHON_FALLTHROUGH;
7979  case 2:
7980  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7981  else {
7982  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 271, __pyx_L3_error)
7983  }
7984  CYTHON_FALLTHROUGH;
7985  case 3:
7986  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7987  else {
7988  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 271, __pyx_L3_error)
7989  }
7990  CYTHON_FALLTHROUGH;
7991  case 4:
7992  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7993  else {
7994  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 271, __pyx_L3_error)
7995  }
7996  CYTHON_FALLTHROUGH;
7997  case 5:
7998  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7999  else {
8000  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 271, __pyx_L3_error)
8001  }
8002  CYTHON_FALLTHROUGH;
8003  case 6:
8004  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
8005  else {
8006  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 271, __pyx_L3_error)
8007  }
8008  }
8009  if (unlikely(kw_args > 0)) {
8010  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
8011  }
8012  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
8013  goto __pyx_L5_argtuple_error;
8014  } else {
8015  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8016  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8017  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8018  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8019  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8020  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8021  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8022  }
8023  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
8024  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error)
8025  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
8026  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
8027  __pyx_v_x = ((PyArrayObject *)values[4]);
8028  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
8029  __pyx_v_material_functions = ((PyObject*)values[6]);
8030  }
8031  goto __pyx_L4_argument_unpacking_done;
8032  __pyx_L5_argtuple_error:;
8033  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
8034  __pyx_L3_error:;
8035  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8036  __Pyx_RefNannyFinishContext();
8037  return NULL;
8038  __pyx_L4_argument_unpacking_done:;
8039  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 273, __pyx_L1_error)
8040  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 274, __pyx_L1_error)
8041  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 275, __pyx_L1_error)
8042  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 276, __pyx_L1_error)
8043  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 277, __pyx_L1_error)
8044  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
8045 
8046  /* function exit code */
8047  goto __pyx_L0;
8048  __pyx_L1_error:;
8049  __pyx_r = NULL;
8050  __pyx_L0:;
8051  __Pyx_RefNannyFinishContext();
8052  return __pyx_r;
8053 }
8054 
8055 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
8056  int __pyx_v_ebN;
8057  int __pyx_v_k;
8058  int __pyx_v_material_left;
8059  int __pyx_v_material_right;
8060  int __pyx_v_I;
8061  int __pyx_v_J;
8062  double __pyx_v_numer;
8063  double __pyx_v_denom;
8064  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
8065  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
8066  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
8067  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
8068  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
8069  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
8070  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
8071  __Pyx_Buffer __pyx_pybuffer_x;
8072  PyObject *__pyx_r = NULL;
8073  __Pyx_RefNannyDeclarations
8074  npy_intp __pyx_t_1;
8075  npy_intp __pyx_t_2;
8076  int __pyx_t_3;
8077  Py_ssize_t __pyx_t_4;
8078  Py_ssize_t __pyx_t_5;
8079  int __pyx_t_6;
8080  npy_intp __pyx_t_7;
8081  npy_intp __pyx_t_8;
8082  int __pyx_t_9;
8083  int __pyx_t_10;
8084  int __pyx_t_11;
8085  int __pyx_t_12;
8086  int __pyx_t_13;
8087  int __pyx_t_14;
8088  PyObject *__pyx_t_15 = NULL;
8089  PyObject *__pyx_t_16 = NULL;
8090  PyObject *__pyx_t_17 = NULL;
8091  PyObject *__pyx_t_18 = NULL;
8092  PyObject *__pyx_t_19 = NULL;
8093  int __pyx_t_20;
8094  PyObject *__pyx_t_21 = NULL;
8095  PyObject *__pyx_t_22 = NULL;
8096  double __pyx_t_23;
8097  Py_ssize_t __pyx_t_24;
8098  int __pyx_lineno = 0;
8099  const char *__pyx_filename = NULL;
8100  int __pyx_clineno = 0;
8101  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
8102  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
8103  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
8104  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
8105  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
8106  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
8107  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
8108  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
8109  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
8110  __pyx_pybuffer_x.pybuffer.buf = NULL;
8111  __pyx_pybuffer_x.refcount = 0;
8112  __pyx_pybuffernd_x.data = NULL;
8113  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
8114  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
8115  __pyx_pybuffer_ebq_global_vals.refcount = 0;
8116  __pyx_pybuffernd_ebq_global_vals.data = NULL;
8117  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
8118  {
8119  __Pyx_BufFmt_StackElem __pyx_stack[1];
8120  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8121  }
8122  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
8123  {
8124  __Pyx_BufFmt_StackElem __pyx_stack[1];
8125  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8126  }
8127  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
8128  {
8129  __Pyx_BufFmt_StackElem __pyx_stack[1];
8130  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8131  }
8132  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
8133  {
8134  __Pyx_BufFmt_StackElem __pyx_stack[1];
8135  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8136  }
8137  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
8138 
8139  /* "subsurfaceTransportFunctions.pyx":288
8140  * cdef double numer,denom
8141  *
8142  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
8143  * material_left = elementBoundaryTypes[ebN,0]
8144  * material_right= elementBoundaryTypes[ebN,1]
8145  */
8146  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
8147  __pyx_t_2 = __pyx_t_1;
8148  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8149  __pyx_v_ebN = __pyx_t_3;
8150 
8151  /* "subsurfaceTransportFunctions.pyx":289
8152  *
8153  * for ebN in range(x.shape[0]):
8154  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
8155  * material_right= elementBoundaryTypes[ebN,1]
8156  * for k in range(x.shape[1]):
8157  */
8158  __pyx_t_4 = __pyx_v_ebN;
8159  __pyx_t_5 = 0;
8160  __pyx_t_6 = -1;
8161  if (__pyx_t_4 < 0) {
8162  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8163  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
8164  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8165  if (__pyx_t_5 < 0) {
8166  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8167  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
8168  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8169  if (unlikely(__pyx_t_6 != -1)) {
8170  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8171  __PYX_ERR(0, 289, __pyx_L1_error)
8172  }
8173  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8174 
8175  /* "subsurfaceTransportFunctions.pyx":290
8176  * for ebN in range(x.shape[0]):
8177  * material_left = elementBoundaryTypes[ebN,0]
8178  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
8179  * for k in range(x.shape[1]):
8180  * for I in range(nd):
8181  */
8182  __pyx_t_5 = __pyx_v_ebN;
8183  __pyx_t_4 = 1;
8184  __pyx_t_6 = -1;
8185  if (__pyx_t_5 < 0) {
8186  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8187  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
8188  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8189  if (__pyx_t_4 < 0) {
8190  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8191  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
8192  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8193  if (unlikely(__pyx_t_6 != -1)) {
8194  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8195  __PYX_ERR(0, 290, __pyx_L1_error)
8196  }
8197  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8198 
8199  /* "subsurfaceTransportFunctions.pyx":291
8200  * material_left = elementBoundaryTypes[ebN,0]
8201  * material_right= elementBoundaryTypes[ebN,1]
8202  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
8203  * for I in range(nd):
8204  * for J in range(nd):
8205  */
8206  __pyx_t_7 = (__pyx_v_x->dimensions[1]);
8207  __pyx_t_8 = __pyx_t_7;
8208  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
8209  __pyx_v_k = __pyx_t_6;
8210 
8211  /* "subsurfaceTransportFunctions.pyx":292
8212  * material_right= elementBoundaryTypes[ebN,1]
8213  * for k in range(x.shape[1]):
8214  * for I in range(nd): # <<<<<<<<<<<<<<
8215  * for J in range(nd):
8216  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8217  */
8218  __pyx_t_9 = __pyx_v_nd;
8219  __pyx_t_10 = __pyx_t_9;
8220  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
8221  __pyx_v_I = __pyx_t_11;
8222 
8223  /* "subsurfaceTransportFunctions.pyx":293
8224  * for k in range(x.shape[1]):
8225  * for I in range(nd):
8226  * for J in range(nd): # <<<<<<<<<<<<<<
8227  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8228  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8229  */
8230  __pyx_t_12 = __pyx_v_nd;
8231  __pyx_t_13 = __pyx_t_12;
8232  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
8233  __pyx_v_J = __pyx_t_14;
8234 
8235  /* "subsurfaceTransportFunctions.pyx":294
8236  * for I in range(nd):
8237  * for J in range(nd):
8238  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
8239  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8240  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8241  */
8242  if (unlikely(__pyx_v_material_functions == Py_None)) {
8243  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8244  __PYX_ERR(0, 294, __pyx_L1_error)
8245  }
8246  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8247  __Pyx_GOTREF(__pyx_t_16);
8248  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8249  __Pyx_GOTREF(__pyx_t_17);
8250  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8251  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8252  __Pyx_GOTREF(__pyx_t_16);
8253  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8254  __Pyx_GOTREF(__pyx_t_18);
8255  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8256  __Pyx_GOTREF(__pyx_t_19);
8257  __Pyx_GIVEREF(__pyx_t_16);
8258  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_16);
8259  __Pyx_GIVEREF(__pyx_t_18);
8260  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_18);
8261  __pyx_t_16 = 0;
8262  __pyx_t_18 = 0;
8263  __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8264  __Pyx_GOTREF(__pyx_t_18);
8265  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8266  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8267  __Pyx_GOTREF(__pyx_t_19);
8268  __pyx_t_16 = NULL;
8269  __pyx_t_20 = 0;
8270  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8271  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
8272  if (likely(__pyx_t_16)) {
8273  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8274  __Pyx_INCREF(__pyx_t_16);
8275  __Pyx_INCREF(function);
8276  __Pyx_DECREF_SET(__pyx_t_17, function);
8277  __pyx_t_20 = 1;
8278  }
8279  }
8280  #if CYTHON_FAST_PYCALL
8281  if (PyFunction_Check(__pyx_t_17)) {
8282  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_18, __pyx_t_19};
8283  __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8284  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8285  __Pyx_GOTREF(__pyx_t_15);
8286  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8287  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8288  } else
8289  #endif
8290  #if CYTHON_FAST_PYCCALL
8291  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8292  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_18, __pyx_t_19};
8293  __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8294  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8295  __Pyx_GOTREF(__pyx_t_15);
8296  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8297  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8298  } else
8299  #endif
8300  {
8301  __pyx_t_21 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8302  __Pyx_GOTREF(__pyx_t_21);
8303  if (__pyx_t_16) {
8304  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_16); __pyx_t_16 = NULL;
8305  }
8306  __Pyx_GIVEREF(__pyx_t_18);
8307  PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_t_18);
8308  __Pyx_GIVEREF(__pyx_t_19);
8309  PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_t_19);
8310  __pyx_t_18 = 0;
8311  __pyx_t_19 = 0;
8312  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_21, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8313  __Pyx_GOTREF(__pyx_t_15);
8314  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8315  }
8316  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8317  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8318  __Pyx_GOTREF(__pyx_t_17);
8319  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8320  __Pyx_GOTREF(__pyx_t_21);
8321  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8322  __Pyx_GOTREF(__pyx_t_19);
8323  __Pyx_GIVEREF(__pyx_t_17);
8324  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17);
8325  __Pyx_GIVEREF(__pyx_t_21);
8326  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
8327  __pyx_t_17 = 0;
8328  __pyx_t_21 = 0;
8329  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8330  __Pyx_GOTREF(__pyx_t_21);
8331  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8332  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8333  __pyx_t_19 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_21); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8334  __Pyx_GOTREF(__pyx_t_19);
8335  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8336  if (unlikely(__pyx_v_material_functions == Py_None)) {
8337  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8338  __PYX_ERR(0, 294, __pyx_L1_error)
8339  }
8340  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8341  __Pyx_GOTREF(__pyx_t_15);
8342  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8343  __Pyx_GOTREF(__pyx_t_17);
8344  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8345  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8346  __Pyx_GOTREF(__pyx_t_15);
8347  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8348  __Pyx_GOTREF(__pyx_t_18);
8349  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8350  __Pyx_GOTREF(__pyx_t_16);
8351  __Pyx_GIVEREF(__pyx_t_15);
8352  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
8353  __Pyx_GIVEREF(__pyx_t_18);
8354  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
8355  __pyx_t_15 = 0;
8356  __pyx_t_18 = 0;
8357  __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8358  __Pyx_GOTREF(__pyx_t_18);
8359  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8360  __pyx_t_16 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8361  __Pyx_GOTREF(__pyx_t_16);
8362  __pyx_t_15 = NULL;
8363  __pyx_t_20 = 0;
8364  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8365  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_17);
8366  if (likely(__pyx_t_15)) {
8367  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8368  __Pyx_INCREF(__pyx_t_15);
8369  __Pyx_INCREF(function);
8370  __Pyx_DECREF_SET(__pyx_t_17, function);
8371  __pyx_t_20 = 1;
8372  }
8373  }
8374  #if CYTHON_FAST_PYCALL
8375  if (PyFunction_Check(__pyx_t_17)) {
8376  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_18, __pyx_t_16};
8377  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8378  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
8379  __Pyx_GOTREF(__pyx_t_21);
8380  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8381  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8382  } else
8383  #endif
8384  #if CYTHON_FAST_PYCCALL
8385  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8386  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_18, __pyx_t_16};
8387  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8388  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
8389  __Pyx_GOTREF(__pyx_t_21);
8390  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8391  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8392  } else
8393  #endif
8394  {
8395  __pyx_t_22 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8396  __Pyx_GOTREF(__pyx_t_22);
8397  if (__pyx_t_15) {
8398  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_15); __pyx_t_15 = NULL;
8399  }
8400  __Pyx_GIVEREF(__pyx_t_18);
8401  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_20, __pyx_t_18);
8402  __Pyx_GIVEREF(__pyx_t_16);
8403  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_20, __pyx_t_16);
8404  __pyx_t_18 = 0;
8405  __pyx_t_16 = 0;
8406  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_22, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8407  __Pyx_GOTREF(__pyx_t_21);
8408  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8409  }
8410  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8411  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8412  __Pyx_GOTREF(__pyx_t_17);
8413  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8414  __Pyx_GOTREF(__pyx_t_22);
8415  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8416  __Pyx_GOTREF(__pyx_t_16);
8417  __Pyx_GIVEREF(__pyx_t_17);
8418  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_17);
8419  __Pyx_GIVEREF(__pyx_t_22);
8420  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_22);
8421  __pyx_t_17 = 0;
8422  __pyx_t_22 = 0;
8423  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_21, __pyx_t_16); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8424  __Pyx_GOTREF(__pyx_t_22);
8425  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8426  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8427  __pyx_t_16 = PyNumber_Multiply(__pyx_t_19, __pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8428  __Pyx_GOTREF(__pyx_t_16);
8429  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8430  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8431  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
8432  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8433  __pyx_v_numer = __pyx_t_23;
8434 
8435  /* "subsurfaceTransportFunctions.pyx":295
8436  * for J in range(nd):
8437  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8438  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
8439  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8440  *
8441  */
8442  if (unlikely(__pyx_v_material_functions == Py_None)) {
8443  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8444  __PYX_ERR(0, 295, __pyx_L1_error)
8445  }
8446  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8447  __Pyx_GOTREF(__pyx_t_22);
8448  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8449  __Pyx_GOTREF(__pyx_t_19);
8450  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8451  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8452  __Pyx_GOTREF(__pyx_t_22);
8453  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8454  __Pyx_GOTREF(__pyx_t_21);
8455  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8456  __Pyx_GOTREF(__pyx_t_17);
8457  __Pyx_GIVEREF(__pyx_t_22);
8458  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_22);
8459  __Pyx_GIVEREF(__pyx_t_21);
8460  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_21);
8461  __pyx_t_22 = 0;
8462  __pyx_t_21 = 0;
8463  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8464  __Pyx_GOTREF(__pyx_t_21);
8465  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8466  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8467  __Pyx_GOTREF(__pyx_t_17);
8468  __pyx_t_22 = NULL;
8469  __pyx_t_20 = 0;
8470  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8471  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_19);
8472  if (likely(__pyx_t_22)) {
8473  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8474  __Pyx_INCREF(__pyx_t_22);
8475  __Pyx_INCREF(function);
8476  __Pyx_DECREF_SET(__pyx_t_19, function);
8477  __pyx_t_20 = 1;
8478  }
8479  }
8480  #if CYTHON_FAST_PYCALL
8481  if (PyFunction_Check(__pyx_t_19)) {
8482  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_17};
8483  __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8484  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
8485  __Pyx_GOTREF(__pyx_t_16);
8486  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8487  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8488  } else
8489  #endif
8490  #if CYTHON_FAST_PYCCALL
8491  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8492  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_17};
8493  __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8494  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
8495  __Pyx_GOTREF(__pyx_t_16);
8496  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8497  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8498  } else
8499  #endif
8500  {
8501  __pyx_t_18 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8502  __Pyx_GOTREF(__pyx_t_18);
8503  if (__pyx_t_22) {
8504  __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_22); __pyx_t_22 = NULL;
8505  }
8506  __Pyx_GIVEREF(__pyx_t_21);
8507  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_20, __pyx_t_21);
8508  __Pyx_GIVEREF(__pyx_t_17);
8509  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_20, __pyx_t_17);
8510  __pyx_t_21 = 0;
8511  __pyx_t_17 = 0;
8512  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_18, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8513  __Pyx_GOTREF(__pyx_t_16);
8514  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8515  }
8516  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8517  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8518  __Pyx_GOTREF(__pyx_t_19);
8519  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8520  __Pyx_GOTREF(__pyx_t_18);
8521  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8522  __Pyx_GOTREF(__pyx_t_17);
8523  __Pyx_GIVEREF(__pyx_t_19);
8524  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19);
8525  __Pyx_GIVEREF(__pyx_t_18);
8526  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18);
8527  __pyx_t_19 = 0;
8528  __pyx_t_18 = 0;
8529  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8530  __Pyx_GOTREF(__pyx_t_18);
8531  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8532  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8533  if (unlikely(__pyx_v_material_functions == Py_None)) {
8534  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8535  __PYX_ERR(0, 295, __pyx_L1_error)
8536  }
8537  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8538  __Pyx_GOTREF(__pyx_t_16);
8539  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8540  __Pyx_GOTREF(__pyx_t_19);
8541  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8542  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8543  __Pyx_GOTREF(__pyx_t_16);
8544  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8545  __Pyx_GOTREF(__pyx_t_21);
8546  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8547  __Pyx_GOTREF(__pyx_t_22);
8548  __Pyx_GIVEREF(__pyx_t_16);
8549  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_16);
8550  __Pyx_GIVEREF(__pyx_t_21);
8551  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_21);
8552  __pyx_t_16 = 0;
8553  __pyx_t_21 = 0;
8554  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8555  __Pyx_GOTREF(__pyx_t_21);
8556  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8557  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8558  __Pyx_GOTREF(__pyx_t_22);
8559  __pyx_t_16 = NULL;
8560  __pyx_t_20 = 0;
8561  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8562  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_19);
8563  if (likely(__pyx_t_16)) {
8564  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8565  __Pyx_INCREF(__pyx_t_16);
8566  __Pyx_INCREF(function);
8567  __Pyx_DECREF_SET(__pyx_t_19, function);
8568  __pyx_t_20 = 1;
8569  }
8570  }
8571  #if CYTHON_FAST_PYCALL
8572  if (PyFunction_Check(__pyx_t_19)) {
8573  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_21, __pyx_t_22};
8574  __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8575  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8576  __Pyx_GOTREF(__pyx_t_17);
8577  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8578  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8579  } else
8580  #endif
8581  #if CYTHON_FAST_PYCCALL
8582  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8583  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_21, __pyx_t_22};
8584  __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8585  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8586  __Pyx_GOTREF(__pyx_t_17);
8587  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8588  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8589  } else
8590  #endif
8591  {
8592  __pyx_t_15 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8593  __Pyx_GOTREF(__pyx_t_15);
8594  if (__pyx_t_16) {
8595  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16); __pyx_t_16 = NULL;
8596  }
8597  __Pyx_GIVEREF(__pyx_t_21);
8598  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_20, __pyx_t_21);
8599  __Pyx_GIVEREF(__pyx_t_22);
8600  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_20, __pyx_t_22);
8601  __pyx_t_21 = 0;
8602  __pyx_t_22 = 0;
8603  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_15, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8604  __Pyx_GOTREF(__pyx_t_17);
8605  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8606  }
8607  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8608  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8609  __Pyx_GOTREF(__pyx_t_19);
8610  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8611  __Pyx_GOTREF(__pyx_t_15);
8612  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8613  __Pyx_GOTREF(__pyx_t_22);
8614  __Pyx_GIVEREF(__pyx_t_19);
8615  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_19);
8616  __Pyx_GIVEREF(__pyx_t_15);
8617  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_15);
8618  __pyx_t_19 = 0;
8619  __pyx_t_15 = 0;
8620  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_22); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8621  __Pyx_GOTREF(__pyx_t_15);
8622  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8623  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8624  __pyx_t_22 = PyNumber_Add(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8625  __Pyx_GOTREF(__pyx_t_22);
8626  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8627  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8628  __pyx_t_15 = __Pyx_PyFloat_AddObjC(__pyx_t_22, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8629  __Pyx_GOTREF(__pyx_t_15);
8630  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8631  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error)
8632  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8633  __pyx_v_denom = __pyx_t_23;
8634 
8635  /* "subsurfaceTransportFunctions.pyx":296
8636  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8637  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8638  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
8639  *
8640  *
8641  */
8642  if (unlikely(__pyx_v_denom == 0)) {
8643  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8644  __PYX_ERR(0, 296, __pyx_L1_error)
8645  }
8646  __pyx_t_4 = __pyx_v_ebN;
8647  __pyx_t_5 = __pyx_v_k;
8648  __pyx_t_24 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
8649  __pyx_t_20 = -1;
8650  if (__pyx_t_4 < 0) {
8651  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
8652  if (unlikely(__pyx_t_4 < 0)) __pyx_t_20 = 0;
8653  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_20 = 0;
8654  if (__pyx_t_5 < 0) {
8655  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
8656  if (unlikely(__pyx_t_5 < 0)) __pyx_t_20 = 1;
8657  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_20 = 1;
8658  if (__pyx_t_24 < 0) {
8659  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
8660  if (unlikely(__pyx_t_24 < 0)) __pyx_t_20 = 2;
8661  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_20 = 2;
8662  if (unlikely(__pyx_t_20 != -1)) {
8663  __Pyx_RaiseBufferIndexError(__pyx_t_20);
8664  __PYX_ERR(0, 296, __pyx_L1_error)
8665  }
8666  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
8667  }
8668  }
8669  }
8670  }
8671 
8672  /* "subsurfaceTransportFunctions.pyx":271
8673  *
8674  *
8675  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8676  * double t,
8677  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8678  */
8679 
8680  /* function exit code */
8681  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8682  goto __pyx_L0;
8683  __pyx_L1_error:;
8684  __Pyx_XDECREF(__pyx_t_15);
8685  __Pyx_XDECREF(__pyx_t_16);
8686  __Pyx_XDECREF(__pyx_t_17);
8687  __Pyx_XDECREF(__pyx_t_18);
8688  __Pyx_XDECREF(__pyx_t_19);
8689  __Pyx_XDECREF(__pyx_t_21);
8690  __Pyx_XDECREF(__pyx_t_22);
8691  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8692  __Pyx_PyThreadState_declare
8693  __Pyx_PyThreadState_assign
8694  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8695  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8696  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8697  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8698  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8699  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8700  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8701  __pyx_r = NULL;
8702  goto __pyx_L2;
8703  __pyx_L0:;
8704  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8705  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8706  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8707  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8708  __pyx_L2:;
8709  __Pyx_XGIVEREF(__pyx_r);
8710  __Pyx_RefNannyFinishContext();
8711  return __pyx_r;
8712 }
8713 
8714 /* "subsurfaceTransportFunctions.pyx":301
8715  *
8716  * ##################################################
8717  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8718  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8719  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8720  */
8721 
8722 /* Python wrapper */
8723 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8724 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8725 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
8726 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8727  double __pyx_v_rho;
8728  PyArrayObject *__pyx_v_gravity = 0;
8729  PyArrayObject *__pyx_v_rowptr = 0;
8730  PyArrayObject *__pyx_v_colind = 0;
8731  PyArrayObject *__pyx_v_KWs = 0;
8732  int __pyx_v_nSpace;
8733  int __pyx_v_nElements_global;
8734  int __pyx_v_nElementBoundaries_element;
8735  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8736  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8737  PyArrayObject *__pyx_v_q_flin = 0;
8738  PyArrayObject *__pyx_v_q_alin = 0;
8739  int __pyx_lineno = 0;
8740  const char *__pyx_filename = NULL;
8741  int __pyx_clineno = 0;
8742  PyObject *__pyx_r = 0;
8743  __Pyx_RefNannyDeclarations
8744  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
8745  {
8746  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
8747  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
8748  if (unlikely(__pyx_kwds)) {
8749  Py_ssize_t kw_args;
8750  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8751  switch (pos_args) {
8752  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8753  CYTHON_FALLTHROUGH;
8754  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8755  CYTHON_FALLTHROUGH;
8756  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8757  CYTHON_FALLTHROUGH;
8758  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8759  CYTHON_FALLTHROUGH;
8760  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8761  CYTHON_FALLTHROUGH;
8762  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8763  CYTHON_FALLTHROUGH;
8764  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8765  CYTHON_FALLTHROUGH;
8766  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8767  CYTHON_FALLTHROUGH;
8768  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8769  CYTHON_FALLTHROUGH;
8770  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8771  CYTHON_FALLTHROUGH;
8772  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8773  CYTHON_FALLTHROUGH;
8774  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8775  CYTHON_FALLTHROUGH;
8776  case 0: break;
8777  default: goto __pyx_L5_argtuple_error;
8778  }
8779  kw_args = PyDict_Size(__pyx_kwds);
8780  switch (pos_args) {
8781  case 0:
8782  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8783  else goto __pyx_L5_argtuple_error;
8784  CYTHON_FALLTHROUGH;
8785  case 1:
8786  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8787  else {
8788  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); __PYX_ERR(0, 301, __pyx_L3_error)
8789  }
8790  CYTHON_FALLTHROUGH;
8791  case 2:
8792  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
8793  else {
8794  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); __PYX_ERR(0, 301, __pyx_L3_error)
8795  }
8796  CYTHON_FALLTHROUGH;
8797  case 3:
8798  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
8799  else {
8800  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); __PYX_ERR(0, 301, __pyx_L3_error)
8801  }
8802  CYTHON_FALLTHROUGH;
8803  case 4:
8804  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
8805  else {
8806  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); __PYX_ERR(0, 301, __pyx_L3_error)
8807  }
8808  CYTHON_FALLTHROUGH;
8809  case 5:
8810  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8811  else {
8812  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); __PYX_ERR(0, 301, __pyx_L3_error)
8813  }
8814  CYTHON_FALLTHROUGH;
8815  case 6:
8816  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8817  else {
8818  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); __PYX_ERR(0, 301, __pyx_L3_error)
8819  }
8820  CYTHON_FALLTHROUGH;
8821  case 7:
8822  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8823  else {
8824  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); __PYX_ERR(0, 301, __pyx_L3_error)
8825  }
8826  CYTHON_FALLTHROUGH;
8827  case 8:
8828  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8829  else {
8830  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); __PYX_ERR(0, 301, __pyx_L3_error)
8831  }
8832  CYTHON_FALLTHROUGH;
8833  case 9:
8834  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8835  else {
8836  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); __PYX_ERR(0, 301, __pyx_L3_error)
8837  }
8838  CYTHON_FALLTHROUGH;
8839  case 10:
8840  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
8841  else {
8842  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); __PYX_ERR(0, 301, __pyx_L3_error)
8843  }
8844  CYTHON_FALLTHROUGH;
8845  case 11:
8846  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
8847  else {
8848  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); __PYX_ERR(0, 301, __pyx_L3_error)
8849  }
8850  }
8851  if (unlikely(kw_args > 0)) {
8852  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
8853  }
8854  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
8855  goto __pyx_L5_argtuple_error;
8856  } else {
8857  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8858  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8859  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8860  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8861  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8862  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8863  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8864  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8865  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8866  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8867  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8868  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8869  }
8870  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error)
8871  __pyx_v_gravity = ((PyArrayObject *)values[1]);
8872  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
8873  __pyx_v_colind = ((PyArrayObject *)values[3]);
8874  __pyx_v_KWs = ((PyArrayObject *)values[4]);
8875  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
8876  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
8877  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
8878  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
8879  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
8880  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
8881  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
8882  }
8883  goto __pyx_L4_argument_unpacking_done;
8884  __pyx_L5_argtuple_error:;
8885  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
8886  __pyx_L3_error:;
8887  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8888  __Pyx_RefNannyFinishContext();
8889  return NULL;
8890  __pyx_L4_argument_unpacking_done:;
8891  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
8892  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
8893  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
8894  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) __PYX_ERR(0, 305, __pyx_L1_error)
8895  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 310, __pyx_L1_error)
8896  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 311, __pyx_L1_error)
8897  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 312, __pyx_L1_error)
8898  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 313, __pyx_L1_error)
8899  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
8900 
8901  /* function exit code */
8902  goto __pyx_L0;
8903  __pyx_L1_error:;
8904  __pyx_r = NULL;
8905  __pyx_L0:;
8906  __Pyx_RefNannyFinishContext();
8907  return __pyx_r;
8908 }
8909 
8910 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin) {
8911  int __pyx_v_eN;
8912  int __pyx_v_eN_neighbor;
8913  int __pyx_v_ii;
8914  int __pyx_v_I;
8915  int __pyx_v_ebN;
8916  int __pyx_v_matID;
8917  int __pyx_v_matID_neig;
8918  CYTHON_UNUSED int __pyx_v_nSpace2;
8919  int __pyx_v_nnz;
8920  PyArrayObject *__pyx_v_a_eN = 0;
8921  PyArrayObject *__pyx_v_a_neig = 0;
8922  PyArrayObject *__pyx_v_a_avg = 0;
8923  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
8924  __Pyx_Buffer __pyx_pybuffer_KWs;
8925  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
8926  __Pyx_Buffer __pyx_pybuffer_a_avg;
8927  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
8928  __Pyx_Buffer __pyx_pybuffer_a_eN;
8929  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
8930  __Pyx_Buffer __pyx_pybuffer_a_neig;
8931  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
8932  __Pyx_Buffer __pyx_pybuffer_colind;
8933  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
8934  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
8935  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
8936  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
8937  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
8938  __Pyx_Buffer __pyx_pybuffer_gravity;
8939  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
8940  __Pyx_Buffer __pyx_pybuffer_q_alin;
8941  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
8942  __Pyx_Buffer __pyx_pybuffer_q_flin;
8943  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
8944  __Pyx_Buffer __pyx_pybuffer_rowptr;
8945  PyObject *__pyx_r = NULL;
8946  __Pyx_RefNannyDeclarations
8947  Py_ssize_t __pyx_t_1;
8948  int __pyx_t_2;
8949  PyObject *__pyx_t_3 = NULL;
8950  PyObject *__pyx_t_4 = NULL;
8951  PyObject *__pyx_t_5 = NULL;
8952  PyObject *__pyx_t_6 = NULL;
8953  PyObject *__pyx_t_7 = NULL;
8954  PyArrayObject *__pyx_t_8 = NULL;
8955  PyArrayObject *__pyx_t_9 = NULL;
8956  PyArrayObject *__pyx_t_10 = NULL;
8957  int __pyx_t_11;
8958  int __pyx_t_12;
8959  int __pyx_t_13;
8960  int __pyx_t_14;
8961  int __pyx_t_15;
8962  Py_ssize_t __pyx_t_16;
8963  int __pyx_t_17;
8964  Py_ssize_t __pyx_t_18;
8965  int __pyx_t_19;
8966  int __pyx_t_20;
8967  int __pyx_t_21;
8968  int __pyx_t_22;
8969  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_23;
8970  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_24;
8971  Py_ssize_t __pyx_t_25;
8972  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_26;
8973  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_27;
8974  int __pyx_t_28;
8975  Py_ssize_t __pyx_t_29;
8976  Py_ssize_t __pyx_t_30;
8977  Py_ssize_t __pyx_t_31;
8978  int __pyx_lineno = 0;
8979  const char *__pyx_filename = NULL;
8980  int __pyx_clineno = 0;
8981  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
8982  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
8983  __pyx_pybuffer_a_eN.refcount = 0;
8984  __pyx_pybuffernd_a_eN.data = NULL;
8985  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
8986  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
8987  __pyx_pybuffer_a_neig.refcount = 0;
8988  __pyx_pybuffernd_a_neig.data = NULL;
8989  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
8990  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
8991  __pyx_pybuffer_a_avg.refcount = 0;
8992  __pyx_pybuffernd_a_avg.data = NULL;
8993  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
8994  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
8995  __pyx_pybuffer_gravity.refcount = 0;
8996  __pyx_pybuffernd_gravity.data = NULL;
8997  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
8998  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
8999  __pyx_pybuffer_rowptr.refcount = 0;
9000  __pyx_pybuffernd_rowptr.data = NULL;
9001  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
9002  __pyx_pybuffer_colind.pybuffer.buf = NULL;
9003  __pyx_pybuffer_colind.refcount = 0;
9004  __pyx_pybuffernd_colind.data = NULL;
9005  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
9006  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
9007  __pyx_pybuffer_KWs.refcount = 0;
9008  __pyx_pybuffernd_KWs.data = NULL;
9009  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
9010  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
9011  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
9012  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
9013  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
9014  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
9015  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
9016  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
9017  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
9018  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
9019  __pyx_pybuffer_q_flin.refcount = 0;
9020  __pyx_pybuffernd_q_flin.data = NULL;
9021  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
9022  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
9023  __pyx_pybuffer_q_alin.refcount = 0;
9024  __pyx_pybuffernd_q_alin.data = NULL;
9025  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
9026  {
9027  __Pyx_BufFmt_StackElem __pyx_stack[1];
9028  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9029  }
9030  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
9031  {
9032  __Pyx_BufFmt_StackElem __pyx_stack[1];
9033  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9034  }
9035  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
9036  {
9037  __Pyx_BufFmt_StackElem __pyx_stack[1];
9038  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9039  }
9040  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
9041  {
9042  __Pyx_BufFmt_StackElem __pyx_stack[1];
9043  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9044  }
9045  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
9046  {
9047  __Pyx_BufFmt_StackElem __pyx_stack[1];
9048  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9049  }
9050  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
9051  {
9052  __Pyx_BufFmt_StackElem __pyx_stack[1];
9053  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9054  }
9055  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
9056  {
9057  __Pyx_BufFmt_StackElem __pyx_stack[1];
9058  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9059  }
9060  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
9061  {
9062  __Pyx_BufFmt_StackElem __pyx_stack[1];
9063  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9064  }
9065  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
9066 
9067  /* "subsurfaceTransportFunctions.pyx":328
9068  * #temporaries
9069  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9070  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
9071  * cdef int nnz = rowptr[nSpace]
9072  *
9073  */
9074  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
9075 
9076  /* "subsurfaceTransportFunctions.pyx":329
9077  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9078  * cdef int nSpace2 = nSpace*nSpace
9079  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
9080  *
9081  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9082  */
9083  __pyx_t_1 = __pyx_v_nSpace;
9084  __pyx_t_2 = -1;
9085  if (__pyx_t_1 < 0) {
9086  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9087  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
9088  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
9089  if (unlikely(__pyx_t_2 != -1)) {
9090  __Pyx_RaiseBufferIndexError(__pyx_t_2);
9091  __PYX_ERR(0, 329, __pyx_L1_error)
9092  }
9093  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9094 
9095  /* "subsurfaceTransportFunctions.pyx":331
9096  * cdef int nnz = rowptr[nSpace]
9097  *
9098  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9099  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9100  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9101  */
9102  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9103  __Pyx_GOTREF(__pyx_t_4);
9104  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
9105  __Pyx_GOTREF(__pyx_t_5);
9106  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9107  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9108  __Pyx_GOTREF(__pyx_t_4);
9109  __pyx_t_6 = NULL;
9110  __pyx_t_2 = 0;
9111  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9112  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9113  if (likely(__pyx_t_6)) {
9114  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9115  __Pyx_INCREF(__pyx_t_6);
9116  __Pyx_INCREF(function);
9117  __Pyx_DECREF_SET(__pyx_t_5, function);
9118  __pyx_t_2 = 1;
9119  }
9120  }
9121  #if CYTHON_FAST_PYCALL
9122  if (PyFunction_Check(__pyx_t_5)) {
9123  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9124  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9125  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9126  __Pyx_GOTREF(__pyx_t_3);
9127  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9128  } else
9129  #endif
9130  #if CYTHON_FAST_PYCCALL
9131  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9132  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9133  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9134  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9135  __Pyx_GOTREF(__pyx_t_3);
9136  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9137  } else
9138  #endif
9139  {
9140  __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
9141  __Pyx_GOTREF(__pyx_t_7);
9142  if (__pyx_t_6) {
9143  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
9144  }
9145  __Pyx_GIVEREF(__pyx_t_4);
9146  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_4);
9147  __Pyx_INCREF(__pyx_n_s_d);
9148  __Pyx_GIVEREF(__pyx_n_s_d);
9149  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_n_s_d);
9150  __pyx_t_4 = 0;
9151  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9152  __Pyx_GOTREF(__pyx_t_3);
9153  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9154  }
9155  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9156  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
9157  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
9158  {
9159  __Pyx_BufFmt_StackElem __pyx_stack[1];
9160  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9161  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
9162  __PYX_ERR(0, 331, __pyx_L1_error)
9163  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
9164  }
9165  }
9166  __pyx_t_8 = 0;
9167  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
9168  __pyx_t_3 = 0;
9169 
9170  /* "subsurfaceTransportFunctions.pyx":332
9171  *
9172  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9173  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9174  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9175  *
9176  */
9177  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9178  __Pyx_GOTREF(__pyx_t_5);
9179  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
9180  __Pyx_GOTREF(__pyx_t_7);
9181  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9182  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9183  __Pyx_GOTREF(__pyx_t_5);
9184  __pyx_t_4 = NULL;
9185  __pyx_t_2 = 0;
9186  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9187  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
9188  if (likely(__pyx_t_4)) {
9189  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9190  __Pyx_INCREF(__pyx_t_4);
9191  __Pyx_INCREF(function);
9192  __Pyx_DECREF_SET(__pyx_t_7, function);
9193  __pyx_t_2 = 1;
9194  }
9195  }
9196  #if CYTHON_FAST_PYCALL
9197  if (PyFunction_Check(__pyx_t_7)) {
9198  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9199  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9200  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9201  __Pyx_GOTREF(__pyx_t_3);
9202  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9203  } else
9204  #endif
9205  #if CYTHON_FAST_PYCCALL
9206  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9207  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9208  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9209  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9210  __Pyx_GOTREF(__pyx_t_3);
9211  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9212  } else
9213  #endif
9214  {
9215  __pyx_t_6 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
9216  __Pyx_GOTREF(__pyx_t_6);
9217  if (__pyx_t_4) {
9218  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
9219  }
9220  __Pyx_GIVEREF(__pyx_t_5);
9221  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_5);
9222  __Pyx_INCREF(__pyx_n_s_d);
9223  __Pyx_GIVEREF(__pyx_n_s_d);
9224  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_n_s_d);
9225  __pyx_t_5 = 0;
9226  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9227  __Pyx_GOTREF(__pyx_t_3);
9228  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9229  }
9230  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9231  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
9232  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
9233  {
9234  __Pyx_BufFmt_StackElem __pyx_stack[1];
9235  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9236  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
9237  __PYX_ERR(0, 332, __pyx_L1_error)
9238  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
9239  }
9240  }
9241  __pyx_t_9 = 0;
9242  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
9243  __pyx_t_3 = 0;
9244 
9245  /* "subsurfaceTransportFunctions.pyx":333
9246  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9247  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9248  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9249  *
9250  * #loop through and evaluate
9251  */
9252  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9253  __Pyx_GOTREF(__pyx_t_7);
9254  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
9255  __Pyx_GOTREF(__pyx_t_6);
9256  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9257  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9258  __Pyx_GOTREF(__pyx_t_7);
9259  __pyx_t_5 = NULL;
9260  __pyx_t_2 = 0;
9261  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9262  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9263  if (likely(__pyx_t_5)) {
9264  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9265  __Pyx_INCREF(__pyx_t_5);
9266  __Pyx_INCREF(function);
9267  __Pyx_DECREF_SET(__pyx_t_6, function);
9268  __pyx_t_2 = 1;
9269  }
9270  }
9271  #if CYTHON_FAST_PYCALL
9272  if (PyFunction_Check(__pyx_t_6)) {
9273  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9274  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9275  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9276  __Pyx_GOTREF(__pyx_t_3);
9277  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9278  } else
9279  #endif
9280  #if CYTHON_FAST_PYCCALL
9281  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9282  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9283  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9284  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9285  __Pyx_GOTREF(__pyx_t_3);
9286  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9287  } else
9288  #endif
9289  {
9290  __pyx_t_4 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
9291  __Pyx_GOTREF(__pyx_t_4);
9292  if (__pyx_t_5) {
9293  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
9294  }
9295  __Pyx_GIVEREF(__pyx_t_7);
9296  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_2, __pyx_t_7);
9297  __Pyx_INCREF(__pyx_n_s_d);
9298  __Pyx_GIVEREF(__pyx_n_s_d);
9299  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_2, __pyx_n_s_d);
9300  __pyx_t_7 = 0;
9301  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9302  __Pyx_GOTREF(__pyx_t_3);
9303  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9304  }
9305  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9306  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
9307  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
9308  {
9309  __Pyx_BufFmt_StackElem __pyx_stack[1];
9310  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9311  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
9312  __PYX_ERR(0, 333, __pyx_L1_error)
9313  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
9314  }
9315  }
9316  __pyx_t_10 = 0;
9317  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
9318  __pyx_t_3 = 0;
9319 
9320  /* "subsurfaceTransportFunctions.pyx":336
9321  *
9322  * #loop through and evaluate
9323  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
9324  * matID = elementMaterialTypes[eN]
9325  * for ii in range(nnz):
9326  */
9327  __pyx_t_2 = __pyx_v_nElements_global;
9328  __pyx_t_11 = __pyx_t_2;
9329  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9330  __pyx_v_eN = __pyx_t_12;
9331 
9332  /* "subsurfaceTransportFunctions.pyx":337
9333  * #loop through and evaluate
9334  * for eN in range(nElements_global):
9335  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
9336  * for ii in range(nnz):
9337  * a_eN[ii] = rho*KWs[matID,ii]
9338  */
9339  __pyx_t_1 = __pyx_v_eN;
9340  __pyx_t_13 = -1;
9341  if (__pyx_t_1 < 0) {
9342  __pyx_t_1 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9343  if (unlikely(__pyx_t_1 < 0)) __pyx_t_13 = 0;
9344  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_13 = 0;
9345  if (unlikely(__pyx_t_13 != -1)) {
9346  __Pyx_RaiseBufferIndexError(__pyx_t_13);
9347  __PYX_ERR(0, 337, __pyx_L1_error)
9348  }
9349  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9350 
9351  /* "subsurfaceTransportFunctions.pyx":338
9352  * for eN in range(nElements_global):
9353  * matID = elementMaterialTypes[eN]
9354  * for ii in range(nnz): # <<<<<<<<<<<<<<
9355  * a_eN[ii] = rho*KWs[matID,ii]
9356  * for ebN in range(nElementBoundaries_element):
9357  */
9358  __pyx_t_13 = __pyx_v_nnz;
9359  __pyx_t_14 = __pyx_t_13;
9360  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
9361  __pyx_v_ii = __pyx_t_15;
9362 
9363  /* "subsurfaceTransportFunctions.pyx":339
9364  * matID = elementMaterialTypes[eN]
9365  * for ii in range(nnz):
9366  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
9367  * for ebN in range(nElementBoundaries_element):
9368  * eN_neighbor = elementNeighborsArray[eN,ebN]
9369  */
9370  __pyx_t_1 = __pyx_v_matID;
9371  __pyx_t_16 = __pyx_v_ii;
9372  __pyx_t_17 = -1;
9373  if (__pyx_t_1 < 0) {
9374  __pyx_t_1 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9375  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 0;
9376  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_17 = 0;
9377  if (__pyx_t_16 < 0) {
9378  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9379  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
9380  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_17 = 1;
9381  if (unlikely(__pyx_t_17 != -1)) {
9382  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9383  __PYX_ERR(0, 339, __pyx_L1_error)
9384  }
9385  __pyx_t_18 = __pyx_v_ii;
9386  __pyx_t_17 = -1;
9387  if (__pyx_t_18 < 0) {
9388  __pyx_t_18 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9389  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
9390  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_17 = 0;
9391  if (unlikely(__pyx_t_17 != -1)) {
9392  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9393  __PYX_ERR(0, 339, __pyx_L1_error)
9394  }
9395  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9396  }
9397 
9398  /* "subsurfaceTransportFunctions.pyx":340
9399  * for ii in range(nnz):
9400  * a_eN[ii] = rho*KWs[matID,ii]
9401  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
9402  * eN_neighbor = elementNeighborsArray[eN,ebN]
9403  * for ii in range(nnz):
9404  */
9405  __pyx_t_13 = __pyx_v_nElementBoundaries_element;
9406  __pyx_t_14 = __pyx_t_13;
9407  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
9408  __pyx_v_ebN = __pyx_t_15;
9409 
9410  /* "subsurfaceTransportFunctions.pyx":341
9411  * a_eN[ii] = rho*KWs[matID,ii]
9412  * for ebN in range(nElementBoundaries_element):
9413  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
9414  * for ii in range(nnz):
9415  * a_neig[ii] = a_eN[ii]
9416  */
9417  __pyx_t_16 = __pyx_v_eN;
9418  __pyx_t_1 = __pyx_v_ebN;
9419  __pyx_t_17 = -1;
9420  if (__pyx_t_16 < 0) {
9421  __pyx_t_16 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
9422  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
9423  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_17 = 0;
9424  if (__pyx_t_1 < 0) {
9425  __pyx_t_1 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
9426  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 1;
9427  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_17 = 1;
9428  if (unlikely(__pyx_t_17 != -1)) {
9429  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9430  __PYX_ERR(0, 341, __pyx_L1_error)
9431  }
9432  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
9433 
9434  /* "subsurfaceTransportFunctions.pyx":342
9435  * for ebN in range(nElementBoundaries_element):
9436  * eN_neighbor = elementNeighborsArray[eN,ebN]
9437  * for ii in range(nnz): # <<<<<<<<<<<<<<
9438  * a_neig[ii] = a_eN[ii]
9439  * if eN_neighbor >= 0:
9440  */
9441  __pyx_t_17 = __pyx_v_nnz;
9442  __pyx_t_19 = __pyx_t_17;
9443  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9444  __pyx_v_ii = __pyx_t_20;
9445 
9446  /* "subsurfaceTransportFunctions.pyx":343
9447  * eN_neighbor = elementNeighborsArray[eN,ebN]
9448  * for ii in range(nnz):
9449  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
9450  * if eN_neighbor >= 0:
9451  * matID_neig = elementMaterialTypes[eN_neighbor]
9452  */
9453  __pyx_t_1 = __pyx_v_ii;
9454  __pyx_t_21 = -1;
9455  if (__pyx_t_1 < 0) {
9456  __pyx_t_1 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9457  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9458  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9459  if (unlikely(__pyx_t_21 != -1)) {
9460  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9461  __PYX_ERR(0, 343, __pyx_L1_error)
9462  }
9463  __pyx_t_16 = __pyx_v_ii;
9464  __pyx_t_21 = -1;
9465  if (__pyx_t_16 < 0) {
9466  __pyx_t_16 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9467  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9468  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9469  if (unlikely(__pyx_t_21 != -1)) {
9470  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9471  __PYX_ERR(0, 343, __pyx_L1_error)
9472  }
9473  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_eN.diminfo[0].strides));
9474  }
9475 
9476  /* "subsurfaceTransportFunctions.pyx":344
9477  * for ii in range(nnz):
9478  * a_neig[ii] = a_eN[ii]
9479  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9480  * matID_neig = elementMaterialTypes[eN_neighbor]
9481  * for ii in range(nnz):
9482  */
9483  __pyx_t_22 = ((__pyx_v_eN_neighbor >= 0) != 0);
9484  if (__pyx_t_22) {
9485 
9486  /* "subsurfaceTransportFunctions.pyx":345
9487  * a_neig[ii] = a_eN[ii]
9488  * if eN_neighbor >= 0:
9489  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
9490  * for ii in range(nnz):
9491  * a_neig[ii] = rho*KWs[matID_neig,ii]
9492  */
9493  __pyx_t_1 = __pyx_v_eN_neighbor;
9494  __pyx_t_17 = -1;
9495  if (__pyx_t_1 < 0) {
9496  __pyx_t_1 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9497  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 0;
9498  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_17 = 0;
9499  if (unlikely(__pyx_t_17 != -1)) {
9500  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9501  __PYX_ERR(0, 345, __pyx_L1_error)
9502  }
9503  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9504 
9505  /* "subsurfaceTransportFunctions.pyx":346
9506  * if eN_neighbor >= 0:
9507  * matID_neig = elementMaterialTypes[eN_neighbor]
9508  * for ii in range(nnz): # <<<<<<<<<<<<<<
9509  * a_neig[ii] = rho*KWs[matID_neig,ii]
9510  * for ii in range(nnz):
9511  */
9512  __pyx_t_17 = __pyx_v_nnz;
9513  __pyx_t_19 = __pyx_t_17;
9514  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9515  __pyx_v_ii = __pyx_t_20;
9516 
9517  /* "subsurfaceTransportFunctions.pyx":347
9518  * matID_neig = elementMaterialTypes[eN_neighbor]
9519  * for ii in range(nnz):
9520  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
9521  * for ii in range(nnz):
9522  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9523  */
9524  __pyx_t_1 = __pyx_v_matID_neig;
9525  __pyx_t_16 = __pyx_v_ii;
9526  __pyx_t_21 = -1;
9527  if (__pyx_t_1 < 0) {
9528  __pyx_t_1 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9529  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9530  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_21 = 0;
9531  if (__pyx_t_16 < 0) {
9532  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9533  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 1;
9534  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_21 = 1;
9535  if (unlikely(__pyx_t_21 != -1)) {
9536  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9537  __PYX_ERR(0, 347, __pyx_L1_error)
9538  }
9539  __pyx_t_18 = __pyx_v_ii;
9540  __pyx_t_21 = -1;
9541  if (__pyx_t_18 < 0) {
9542  __pyx_t_18 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9543  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9544  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9545  if (unlikely(__pyx_t_21 != -1)) {
9546  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9547  __PYX_ERR(0, 347, __pyx_L1_error)
9548  }
9549  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9550  }
9551 
9552  /* "subsurfaceTransportFunctions.pyx":344
9553  * for ii in range(nnz):
9554  * a_neig[ii] = a_eN[ii]
9555  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9556  * matID_neig = elementMaterialTypes[eN_neighbor]
9557  * for ii in range(nnz):
9558  */
9559  }
9560 
9561  /* "subsurfaceTransportFunctions.pyx":348
9562  * for ii in range(nnz):
9563  * a_neig[ii] = rho*KWs[matID_neig,ii]
9564  * for ii in range(nnz): # <<<<<<<<<<<<<<
9565  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9566  * q_alin[eN,ebN,ii] = a_avg[ii]
9567  */
9568  __pyx_t_17 = __pyx_v_nnz;
9569  __pyx_t_19 = __pyx_t_17;
9570  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9571  __pyx_v_ii = __pyx_t_20;
9572 
9573  /* "subsurfaceTransportFunctions.pyx":349
9574  * a_neig[ii] = rho*KWs[matID_neig,ii]
9575  * for ii in range(nnz):
9576  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
9577  * q_alin[eN,ebN,ii] = a_avg[ii]
9578  * for I in range(nSpace):
9579  */
9580  __pyx_t_16 = __pyx_v_ii;
9581  __pyx_t_21 = -1;
9582  if (__pyx_t_16 < 0) {
9583  __pyx_t_16 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9584  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9585  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9586  if (unlikely(__pyx_t_21 != -1)) {
9587  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9588  __PYX_ERR(0, 349, __pyx_L1_error)
9589  }
9590  __pyx_t_1 = __pyx_v_ii;
9591  __pyx_t_21 = -1;
9592  if (__pyx_t_1 < 0) {
9593  __pyx_t_1 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9594  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9595  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9596  if (unlikely(__pyx_t_21 != -1)) {
9597  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9598  __PYX_ERR(0, 349, __pyx_L1_error)
9599  }
9600  __pyx_t_23 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
9601  __pyx_t_1 = __pyx_v_ii;
9602  __pyx_t_21 = -1;
9603  if (__pyx_t_1 < 0) {
9604  __pyx_t_1 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9605  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9606  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9607  if (unlikely(__pyx_t_21 != -1)) {
9608  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9609  __PYX_ERR(0, 349, __pyx_L1_error)
9610  }
9611  __pyx_t_16 = __pyx_v_ii;
9612  __pyx_t_21 = -1;
9613  if (__pyx_t_16 < 0) {
9614  __pyx_t_16 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9615  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9616  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9617  if (unlikely(__pyx_t_21 != -1)) {
9618  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9619  __PYX_ERR(0, 349, __pyx_L1_error)
9620  }
9621  __pyx_t_24 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
9622  if (unlikely(__pyx_t_24 == 0)) {
9623  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9624  __PYX_ERR(0, 349, __pyx_L1_error)
9625  }
9626  __pyx_t_16 = __pyx_v_ii;
9627  __pyx_t_21 = -1;
9628  if (__pyx_t_16 < 0) {
9629  __pyx_t_16 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9630  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9631  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_21 = 0;
9632  if (unlikely(__pyx_t_21 != -1)) {
9633  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9634  __PYX_ERR(0, 349, __pyx_L1_error)
9635  }
9636  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_23 / __pyx_t_24);
9637 
9638  /* "subsurfaceTransportFunctions.pyx":350
9639  * for ii in range(nnz):
9640  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9641  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
9642  * for I in range(nSpace):
9643  * q_flin[eN,ebN,I] = 0.0
9644  */
9645  __pyx_t_16 = __pyx_v_ii;
9646  __pyx_t_21 = -1;
9647  if (__pyx_t_16 < 0) {
9648  __pyx_t_16 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9649  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9650  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_21 = 0;
9651  if (unlikely(__pyx_t_21 != -1)) {
9652  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9653  __PYX_ERR(0, 350, __pyx_L1_error)
9654  }
9655  __pyx_t_1 = __pyx_v_eN;
9656  __pyx_t_18 = __pyx_v_ebN;
9657  __pyx_t_25 = __pyx_v_ii;
9658  __pyx_t_21 = -1;
9659  if (__pyx_t_1 < 0) {
9660  __pyx_t_1 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
9661  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9662  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_21 = 0;
9663  if (__pyx_t_18 < 0) {
9664  __pyx_t_18 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
9665  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 1;
9666  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_21 = 1;
9667  if (__pyx_t_25 < 0) {
9668  __pyx_t_25 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
9669  if (unlikely(__pyx_t_25 < 0)) __pyx_t_21 = 2;
9670  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_21 = 2;
9671  if (unlikely(__pyx_t_21 != -1)) {
9672  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9673  __PYX_ERR(0, 350, __pyx_L1_error)
9674  }
9675  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_avg.diminfo[0].strides));
9676  }
9677 
9678  /* "subsurfaceTransportFunctions.pyx":351
9679  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9680  * q_alin[eN,ebN,ii] = a_avg[ii]
9681  * for I in range(nSpace): # <<<<<<<<<<<<<<
9682  * q_flin[eN,ebN,I] = 0.0
9683  * for ii in range(rowptr[I],rowptr[I+1]):
9684  */
9685  __pyx_t_17 = __pyx_v_nSpace;
9686  __pyx_t_19 = __pyx_t_17;
9687  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9688  __pyx_v_I = __pyx_t_20;
9689 
9690  /* "subsurfaceTransportFunctions.pyx":352
9691  * q_alin[eN,ebN,ii] = a_avg[ii]
9692  * for I in range(nSpace):
9693  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
9694  * for ii in range(rowptr[I],rowptr[I+1]):
9695  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9696  */
9697  __pyx_t_16 = __pyx_v_eN;
9698  __pyx_t_25 = __pyx_v_ebN;
9699  __pyx_t_18 = __pyx_v_I;
9700  __pyx_t_21 = -1;
9701  if (__pyx_t_16 < 0) {
9702  __pyx_t_16 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9703  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9704  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_21 = 0;
9705  if (__pyx_t_25 < 0) {
9706  __pyx_t_25 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9707  if (unlikely(__pyx_t_25 < 0)) __pyx_t_21 = 1;
9708  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_21 = 1;
9709  if (__pyx_t_18 < 0) {
9710  __pyx_t_18 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9711  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 2;
9712  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_21 = 2;
9713  if (unlikely(__pyx_t_21 != -1)) {
9714  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9715  __PYX_ERR(0, 352, __pyx_L1_error)
9716  }
9717  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
9718 
9719  /* "subsurfaceTransportFunctions.pyx":353
9720  * for I in range(nSpace):
9721  * q_flin[eN,ebN,I] = 0.0
9722  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
9723  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9724  * #ebN
9725  */
9726  __pyx_t_18 = (__pyx_v_I + 1);
9727  __pyx_t_21 = -1;
9728  if (__pyx_t_18 < 0) {
9729  __pyx_t_18 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9730  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9731  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_21 = 0;
9732  if (unlikely(__pyx_t_21 != -1)) {
9733  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9734  __PYX_ERR(0, 353, __pyx_L1_error)
9735  }
9736  __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9737  __pyx_t_18 = __pyx_v_I;
9738  __pyx_t_21 = -1;
9739  if (__pyx_t_18 < 0) {
9740  __pyx_t_18 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9741  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9742  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_21 = 0;
9743  if (unlikely(__pyx_t_21 != -1)) {
9744  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9745  __PYX_ERR(0, 353, __pyx_L1_error)
9746  }
9747  __pyx_t_27 = __pyx_t_26;
9748  for (__pyx_t_21 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_21 < __pyx_t_27; __pyx_t_21+=1) {
9749  __pyx_v_ii = __pyx_t_21;
9750 
9751  /* "subsurfaceTransportFunctions.pyx":354
9752  * q_flin[eN,ebN,I] = 0.0
9753  * for ii in range(rowptr[I],rowptr[I+1]):
9754  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
9755  * #ebN
9756  * #eN
9757  */
9758  __pyx_t_25 = __pyx_v_ii;
9759  __pyx_t_28 = -1;
9760  if (__pyx_t_25 < 0) {
9761  __pyx_t_25 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9762  if (unlikely(__pyx_t_25 < 0)) __pyx_t_28 = 0;
9763  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_28 = 0;
9764  if (unlikely(__pyx_t_28 != -1)) {
9765  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9766  __PYX_ERR(0, 354, __pyx_L1_error)
9767  }
9768  __pyx_t_16 = __pyx_v_ii;
9769  __pyx_t_28 = -1;
9770  if (__pyx_t_16 < 0) {
9771  __pyx_t_16 += __pyx_pybuffernd_colind.diminfo[0].shape;
9772  if (unlikely(__pyx_t_16 < 0)) __pyx_t_28 = 0;
9773  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_28 = 0;
9774  if (unlikely(__pyx_t_28 != -1)) {
9775  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9776  __PYX_ERR(0, 354, __pyx_L1_error)
9777  }
9778  __pyx_t_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_colind.diminfo[0].strides));
9779  __pyx_t_28 = -1;
9780  if (__pyx_t_1 < 0) {
9781  __pyx_t_1 += __pyx_pybuffernd_gravity.diminfo[0].shape;
9782  if (unlikely(__pyx_t_1 < 0)) __pyx_t_28 = 0;
9783  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_28 = 0;
9784  if (unlikely(__pyx_t_28 != -1)) {
9785  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9786  __PYX_ERR(0, 354, __pyx_L1_error)
9787  }
9788  __pyx_t_29 = __pyx_v_eN;
9789  __pyx_t_30 = __pyx_v_ebN;
9790  __pyx_t_31 = __pyx_v_I;
9791  __pyx_t_28 = -1;
9792  if (__pyx_t_29 < 0) {
9793  __pyx_t_29 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9794  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
9795  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_28 = 0;
9796  if (__pyx_t_30 < 0) {
9797  __pyx_t_30 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9798  if (unlikely(__pyx_t_30 < 0)) __pyx_t_28 = 1;
9799  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_28 = 1;
9800  if (__pyx_t_31 < 0) {
9801  __pyx_t_31 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9802  if (unlikely(__pyx_t_31 < 0)) __pyx_t_28 = 2;
9803  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_28 = 2;
9804  if (unlikely(__pyx_t_28 != -1)) {
9805  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9806  __PYX_ERR(0, 354, __pyx_L1_error)
9807  }
9808  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_gravity.diminfo[0].strides)));
9809  }
9810  }
9811  }
9812  }
9813 
9814  /* "subsurfaceTransportFunctions.pyx":301
9815  *
9816  * ##################################################
9817  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
9818  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9819  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
9820  */
9821 
9822  /* function exit code */
9823  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9824  goto __pyx_L0;
9825  __pyx_L1_error:;
9826  __Pyx_XDECREF(__pyx_t_3);
9827  __Pyx_XDECREF(__pyx_t_4);
9828  __Pyx_XDECREF(__pyx_t_5);
9829  __Pyx_XDECREF(__pyx_t_6);
9830  __Pyx_XDECREF(__pyx_t_7);
9831  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9832  __Pyx_PyThreadState_declare
9833  __Pyx_PyThreadState_assign
9834  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9835  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9836  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9837  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9838  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9839  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9840  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9841  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9843  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9844  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9845  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9846  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9847  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
9848  __pyx_r = NULL;
9849  goto __pyx_L2;
9850  __pyx_L0:;
9851  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9852  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9853  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9854  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9855  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9856  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9857  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9858  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9859  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9860  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9861  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9862  __pyx_L2:;
9863  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
9864  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
9865  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
9866  __Pyx_XGIVEREF(__pyx_r);
9867  __Pyx_RefNannyFinishContext();
9868  return __pyx_r;
9869 }
9870 
9871 /* "subsurfaceTransportFunctions.pyx":359
9872  *
9873  *
9874  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
9875  * double beta,
9876  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9877  */
9878 
9879 /* Python wrapper */
9880 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9881 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
9882 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
9883 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9884  double __pyx_v_rho;
9885  double __pyx_v_beta;
9886  PyArrayObject *__pyx_v_gravity = 0;
9887  PyArrayObject *__pyx_v_alpha = 0;
9888  PyArrayObject *__pyx_v_n = 0;
9889  PyArrayObject *__pyx_v_thetaR = 0;
9890  PyArrayObject *__pyx_v_thetaSR = 0;
9891  int __pyx_v_nSpace;
9892  int __pyx_v_nElements_global;
9893  int __pyx_v_nElementBoundaries_element;
9894  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
9895  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
9896  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
9897  int __pyx_v_nDOF_trial_element;
9898  PyArrayObject *__pyx_v_u_l2g = 0;
9899  PyArrayObject *__pyx_v_u_dof = 0;
9900  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
9901  PyArrayObject *__pyx_v_q_u = 0;
9902  PyArrayObject *__pyx_v_q_mass = 0;
9903  PyArrayObject *__pyx_v_q_dmass = 0;
9904  PyArrayObject *__pyx_v_q_r = 0;
9905  PyArrayObject *__pyx_v_q_kr = 0;
9906  PyArrayObject *__pyx_v_q_dkr = 0;
9907  PyArrayObject *__pyx_v_q_kr_up = 0;
9908  int __pyx_lineno = 0;
9909  const char *__pyx_filename = NULL;
9910  int __pyx_clineno = 0;
9911  PyObject *__pyx_r = 0;
9912  __Pyx_RefNannyDeclarations
9913  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
9914  {
9915  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
9916  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
9917  if (unlikely(__pyx_kwds)) {
9918  Py_ssize_t kw_args;
9919  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9920  switch (pos_args) {
9921  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
9922  CYTHON_FALLTHROUGH;
9923  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
9924  CYTHON_FALLTHROUGH;
9925  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
9926  CYTHON_FALLTHROUGH;
9927  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
9928  CYTHON_FALLTHROUGH;
9929  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
9930  CYTHON_FALLTHROUGH;
9931  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
9932  CYTHON_FALLTHROUGH;
9933  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
9934  CYTHON_FALLTHROUGH;
9935  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
9936  CYTHON_FALLTHROUGH;
9937  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
9938  CYTHON_FALLTHROUGH;
9939  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
9940  CYTHON_FALLTHROUGH;
9941  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
9942  CYTHON_FALLTHROUGH;
9943  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
9944  CYTHON_FALLTHROUGH;
9945  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
9946  CYTHON_FALLTHROUGH;
9947  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
9948  CYTHON_FALLTHROUGH;
9949  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
9950  CYTHON_FALLTHROUGH;
9951  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
9952  CYTHON_FALLTHROUGH;
9953  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
9954  CYTHON_FALLTHROUGH;
9955  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
9956  CYTHON_FALLTHROUGH;
9957  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
9958  CYTHON_FALLTHROUGH;
9959  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9960  CYTHON_FALLTHROUGH;
9961  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9962  CYTHON_FALLTHROUGH;
9963  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9964  CYTHON_FALLTHROUGH;
9965  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9966  CYTHON_FALLTHROUGH;
9967  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9968  CYTHON_FALLTHROUGH;
9969  case 0: break;
9970  default: goto __pyx_L5_argtuple_error;
9971  }
9972  kw_args = PyDict_Size(__pyx_kwds);
9973  switch (pos_args) {
9974  case 0:
9975  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
9976  else goto __pyx_L5_argtuple_error;
9977  CYTHON_FALLTHROUGH;
9978  case 1:
9979  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
9980  else {
9981  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); __PYX_ERR(0, 359, __pyx_L3_error)
9982  }
9983  CYTHON_FALLTHROUGH;
9984  case 2:
9985  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
9986  else {
9987  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); __PYX_ERR(0, 359, __pyx_L3_error)
9988  }
9989  CYTHON_FALLTHROUGH;
9990  case 3:
9991  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
9992  else {
9993  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); __PYX_ERR(0, 359, __pyx_L3_error)
9994  }
9995  CYTHON_FALLTHROUGH;
9996  case 4:
9997  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
9998  else {
9999  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); __PYX_ERR(0, 359, __pyx_L3_error)
10000  }
10001  CYTHON_FALLTHROUGH;
10002  case 5:
10003  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
10004  else {
10005  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); __PYX_ERR(0, 359, __pyx_L3_error)
10006  }
10007  CYTHON_FALLTHROUGH;
10008  case 6:
10009  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
10010  else {
10011  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); __PYX_ERR(0, 359, __pyx_L3_error)
10012  }
10013  CYTHON_FALLTHROUGH;
10014  case 7:
10015  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
10016  else {
10017  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); __PYX_ERR(0, 359, __pyx_L3_error)
10018  }
10019  CYTHON_FALLTHROUGH;
10020  case 8:
10021  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
10022  else {
10023  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); __PYX_ERR(0, 359, __pyx_L3_error)
10024  }
10025  CYTHON_FALLTHROUGH;
10026  case 9:
10027  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
10028  else {
10029  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); __PYX_ERR(0, 359, __pyx_L3_error)
10030  }
10031  CYTHON_FALLTHROUGH;
10032  case 10:
10033  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
10034  else {
10035  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); __PYX_ERR(0, 359, __pyx_L3_error)
10036  }
10037  CYTHON_FALLTHROUGH;
10038  case 11:
10039  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
10040  else {
10041  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); __PYX_ERR(0, 359, __pyx_L3_error)
10042  }
10043  CYTHON_FALLTHROUGH;
10044  case 12:
10045  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
10046  else {
10047  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); __PYX_ERR(0, 359, __pyx_L3_error)
10048  }
10049  CYTHON_FALLTHROUGH;
10050  case 13:
10051  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
10052  else {
10053  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); __PYX_ERR(0, 359, __pyx_L3_error)
10054  }
10055  CYTHON_FALLTHROUGH;
10056  case 14:
10057  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
10058  else {
10059  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); __PYX_ERR(0, 359, __pyx_L3_error)
10060  }
10061  CYTHON_FALLTHROUGH;
10062  case 15:
10063  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
10064  else {
10065  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); __PYX_ERR(0, 359, __pyx_L3_error)
10066  }
10067  CYTHON_FALLTHROUGH;
10068  case 16:
10069  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
10070  else {
10071  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); __PYX_ERR(0, 359, __pyx_L3_error)
10072  }
10073  CYTHON_FALLTHROUGH;
10074  case 17:
10075  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
10076  else {
10077  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); __PYX_ERR(0, 359, __pyx_L3_error)
10078  }
10079  CYTHON_FALLTHROUGH;
10080  case 18:
10081  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
10082  else {
10083  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); __PYX_ERR(0, 359, __pyx_L3_error)
10084  }
10085  CYTHON_FALLTHROUGH;
10086  case 19:
10087  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
10088  else {
10089  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); __PYX_ERR(0, 359, __pyx_L3_error)
10090  }
10091  CYTHON_FALLTHROUGH;
10092  case 20:
10093  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
10094  else {
10095  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); __PYX_ERR(0, 359, __pyx_L3_error)
10096  }
10097  CYTHON_FALLTHROUGH;
10098  case 21:
10099  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
10100  else {
10101  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); __PYX_ERR(0, 359, __pyx_L3_error)
10102  }
10103  CYTHON_FALLTHROUGH;
10104  case 22:
10105  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
10106  else {
10107  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); __PYX_ERR(0, 359, __pyx_L3_error)
10108  }
10109  CYTHON_FALLTHROUGH;
10110  case 23:
10111  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
10112  else {
10113  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); __PYX_ERR(0, 359, __pyx_L3_error)
10114  }
10115  }
10116  if (unlikely(kw_args > 0)) {
10117  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
10118  }
10119  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
10120  goto __pyx_L5_argtuple_error;
10121  } else {
10122  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10123  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10124  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10125  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10126  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10127  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10128  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10129  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10130  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10131  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10132  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10133  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10134  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10135  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10136  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10137  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10138  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10139  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10140  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10141  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10142  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10143  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
10144  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
10145  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
10146  }
10147  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
10148  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
10149  __pyx_v_gravity = ((PyArrayObject *)values[2]);
10150  __pyx_v_alpha = ((PyArrayObject *)values[3]);
10151  __pyx_v_n = ((PyArrayObject *)values[4]);
10152  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
10153  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
10154  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error)
10155  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
10156  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error)
10157  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
10158  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
10159  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
10160  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error)
10161  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
10162  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
10163  __pyx_v_q_x = ((PyArrayObject *)values[16]);
10164  __pyx_v_q_u = ((PyArrayObject *)values[17]);
10165  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
10166  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
10167  __pyx_v_q_r = ((PyArrayObject *)values[20]);
10168  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
10169  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
10170  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
10171  }
10172  goto __pyx_L4_argument_unpacking_done;
10173  __pyx_L5_argtuple_error:;
10174  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
10175  __pyx_L3_error:;
10176  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
10177  __Pyx_RefNannyFinishContext();
10178  return NULL;
10179  __pyx_L4_argument_unpacking_done:;
10180  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 361, __pyx_L1_error)
10181  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
10182  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
10183  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) __PYX_ERR(0, 364, __pyx_L1_error)
10184  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) __PYX_ERR(0, 365, __pyx_L1_error)
10185  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 370, __pyx_L1_error)
10186  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 371, __pyx_L1_error)
10187  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 372, __pyx_L1_error)
10188  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) __PYX_ERR(0, 375, __pyx_L1_error)
10189  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) __PYX_ERR(0, 376, __pyx_L1_error)
10190  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) __PYX_ERR(0, 378, __pyx_L1_error)
10191  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 379, __pyx_L1_error)
10192  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) __PYX_ERR(0, 380, __pyx_L1_error)
10193  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
10194  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
10195  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 383, __pyx_L1_error)
10196  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
10197  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
10198  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
10199 
10200  /* function exit code */
10201  goto __pyx_L0;
10202  __pyx_L1_error:;
10203  __pyx_r = NULL;
10204  __pyx_L0:;
10205  __Pyx_RefNannyFinishContext();
10206  return __pyx_r;
10207 }
10208 
10209 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up) {
10210  PyObject *__pyx_v_q = NULL;
10211  double __pyx_v_psiC;
10212  double __pyx_v_pcBar;
10213  double __pyx_v_pcBar_n;
10214  double __pyx_v_pcBar_nM1;
10215  double __pyx_v_pcBar_nM2;
10216  double __pyx_v_onePlus_pcBar_n;
10217  double __pyx_v_sBar;
10218  double __pyx_v_sqrt_sBar;
10219  double __pyx_v_DsBar_DpsiC;
10220  double __pyx_v_thetaW;
10221  double __pyx_v_DthetaW_DpsiC;
10222  double __pyx_v_vBar;
10223  double __pyx_v_vBar2;
10224  double __pyx_v_DvBar_DpsiC;
10225  double __pyx_v_KWr;
10226  double __pyx_v_DKWr_DpsiC;
10227  CYTHON_UNUSED double __pyx_v_rho2;
10228  double __pyx_v_thetaS;
10229  double __pyx_v_rhom;
10230  double __pyx_v_drhom;
10231  double __pyx_v_m;
10232  double __pyx_v_u_j;
10233  double __pyx_v_u_eN;
10234  double __pyx_v_u_neig;
10235  double __pyx_v_kr_eN;
10236  double __pyx_v_kr_neig;
10237  double __pyx_v_phi_eN;
10238  double __pyx_v_phi_neig;
10239  int __pyx_v_eN;
10240  int __pyx_v_eN_neighbor;
10241  int __pyx_v_ebN;
10242  int __pyx_v_j;
10243  int __pyx_v_matID;
10244  double __pyx_v_nAvgWeight;
10245  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
10246  __Pyx_Buffer __pyx_pybuffer_alpha;
10247  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
10248  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
10249  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
10250  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
10251  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
10252  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
10253  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
10254  __Pyx_Buffer __pyx_pybuffer_gravity;
10255  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
10256  __Pyx_Buffer __pyx_pybuffer_n;
10257  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
10258  __Pyx_Buffer __pyx_pybuffer_q_dkr;
10259  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
10260  __Pyx_Buffer __pyx_pybuffer_q_dmass;
10261  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
10262  __Pyx_Buffer __pyx_pybuffer_q_kr;
10263  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
10264  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
10265  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
10266  __Pyx_Buffer __pyx_pybuffer_q_mass;
10267  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
10268  __Pyx_Buffer __pyx_pybuffer_q_r;
10269  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
10270  __Pyx_Buffer __pyx_pybuffer_q_u;
10271  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
10272  __Pyx_Buffer __pyx_pybuffer_q_x;
10273  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
10274  __Pyx_Buffer __pyx_pybuffer_thetaR;
10275  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
10276  __Pyx_Buffer __pyx_pybuffer_thetaSR;
10277  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
10278  __Pyx_Buffer __pyx_pybuffer_u_dof;
10279  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
10280  __Pyx_Buffer __pyx_pybuffer_u_l2g;
10281  PyObject *__pyx_r = NULL;
10282  __Pyx_RefNannyDeclarations
10283  PyObject *__pyx_t_1 = NULL;
10284  PyObject *__pyx_t_2 = NULL;
10285  Py_ssize_t __pyx_t_3;
10286  PyObject *__pyx_t_4 = NULL;
10287  PyObject *__pyx_t_5 = NULL;
10288  int __pyx_t_6;
10289  double __pyx_t_7;
10290  int __pyx_t_8;
10291  int __pyx_t_9;
10292  int __pyx_t_10;
10293  Py_ssize_t __pyx_t_11;
10294  int __pyx_t_12;
10295  int __pyx_t_13;
10296  int __pyx_t_14;
10297  Py_ssize_t __pyx_t_15;
10298  int __pyx_t_16;
10299  Py_ssize_t __pyx_t_17;
10300  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_18;
10301  PyObject *__pyx_t_19 = NULL;
10302  PyObject *__pyx_t_20 = NULL;
10303  int __pyx_lineno = 0;
10304  const char *__pyx_filename = NULL;
10305  int __pyx_clineno = 0;
10306  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
10307  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
10308  __pyx_pybuffer_gravity.refcount = 0;
10309  __pyx_pybuffernd_gravity.data = NULL;
10310  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
10311  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
10312  __pyx_pybuffer_alpha.refcount = 0;
10313  __pyx_pybuffernd_alpha.data = NULL;
10314  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
10315  __pyx_pybuffer_n.pybuffer.buf = NULL;
10316  __pyx_pybuffer_n.refcount = 0;
10317  __pyx_pybuffernd_n.data = NULL;
10318  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
10319  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
10320  __pyx_pybuffer_thetaR.refcount = 0;
10321  __pyx_pybuffernd_thetaR.data = NULL;
10322  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
10323  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
10324  __pyx_pybuffer_thetaSR.refcount = 0;
10325  __pyx_pybuffernd_thetaSR.data = NULL;
10326  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
10327  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
10328  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
10329  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
10330  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
10331  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
10332  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
10333  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
10334  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
10335  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
10336  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
10337  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
10338  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
10339  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
10340  __pyx_pybuffer_u_l2g.refcount = 0;
10341  __pyx_pybuffernd_u_l2g.data = NULL;
10342  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
10343  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
10344  __pyx_pybuffer_u_dof.refcount = 0;
10345  __pyx_pybuffernd_u_dof.data = NULL;
10346  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
10347  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
10348  __pyx_pybuffer_q_x.refcount = 0;
10349  __pyx_pybuffernd_q_x.data = NULL;
10350  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
10351  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
10352  __pyx_pybuffer_q_u.refcount = 0;
10353  __pyx_pybuffernd_q_u.data = NULL;
10354  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
10355  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
10356  __pyx_pybuffer_q_mass.refcount = 0;
10357  __pyx_pybuffernd_q_mass.data = NULL;
10358  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
10359  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
10360  __pyx_pybuffer_q_dmass.refcount = 0;
10361  __pyx_pybuffernd_q_dmass.data = NULL;
10362  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
10363  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
10364  __pyx_pybuffer_q_r.refcount = 0;
10365  __pyx_pybuffernd_q_r.data = NULL;
10366  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
10367  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
10368  __pyx_pybuffer_q_kr.refcount = 0;
10369  __pyx_pybuffernd_q_kr.data = NULL;
10370  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
10371  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
10372  __pyx_pybuffer_q_dkr.refcount = 0;
10373  __pyx_pybuffernd_q_dkr.data = NULL;
10374  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
10375  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
10376  __pyx_pybuffer_q_kr_up.refcount = 0;
10377  __pyx_pybuffernd_q_kr_up.data = NULL;
10378  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
10379  {
10380  __Pyx_BufFmt_StackElem __pyx_stack[1];
10381  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10382  }
10383  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
10384  {
10385  __Pyx_BufFmt_StackElem __pyx_stack[1];
10386  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10387  }
10388  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
10389  {
10390  __Pyx_BufFmt_StackElem __pyx_stack[1];
10391  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10392  }
10393  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
10394  {
10395  __Pyx_BufFmt_StackElem __pyx_stack[1];
10396  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10397  }
10398  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
10399  {
10400  __Pyx_BufFmt_StackElem __pyx_stack[1];
10401  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10402  }
10403  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
10404  {
10405  __Pyx_BufFmt_StackElem __pyx_stack[1];
10406  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10407  }
10408  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
10409  {
10410  __Pyx_BufFmt_StackElem __pyx_stack[1];
10411  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10412  }
10413  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
10414  {
10415  __Pyx_BufFmt_StackElem __pyx_stack[1];
10416  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10417  }
10418  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
10419  {
10420  __Pyx_BufFmt_StackElem __pyx_stack[1];
10421  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10422  }
10423  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
10424  {
10425  __Pyx_BufFmt_StackElem __pyx_stack[1];
10426  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10427  }
10428  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
10429  {
10430  __Pyx_BufFmt_StackElem __pyx_stack[1];
10431  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10432  }
10433  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
10434  {
10435  __Pyx_BufFmt_StackElem __pyx_stack[1];
10436  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10437  }
10438  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
10439  {
10440  __Pyx_BufFmt_StackElem __pyx_stack[1];
10441  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10442  }
10443  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
10444  {
10445  __Pyx_BufFmt_StackElem __pyx_stack[1];
10446  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10447  }
10448  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
10449  {
10450  __Pyx_BufFmt_StackElem __pyx_stack[1];
10451  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10452  }
10453  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
10454  {
10455  __Pyx_BufFmt_StackElem __pyx_stack[1];
10456  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10457  }
10458  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
10459  {
10460  __Pyx_BufFmt_StackElem __pyx_stack[1];
10461  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10462  }
10463  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
10464  {
10465  __Pyx_BufFmt_StackElem __pyx_stack[1];
10466  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10467  }
10468  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
10469 
10470  /* "subsurfaceTransportFunctions.pyx":399
10471  * """
10472  * #check some sizes
10473  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10474  * assert q.shape[1] == nSpace+1
10475  * assert nDOF_trial_element == nSpace + 1
10476  */
10477  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10478  __Pyx_GOTREF(__pyx_t_1);
10479  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
10480  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
10481  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
10482  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
10483  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
10484  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
10485  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
10486  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
10487  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
10488  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
10489  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
10490  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
10491  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
10492  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
10493  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
10494  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10495  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10496  for (;;) {
10497  if (__pyx_t_3 >= 5) break;
10498  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10499  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
10500  #else
10501  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10502  __Pyx_GOTREF(__pyx_t_1);
10503  #endif
10504  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
10505  __pyx_t_1 = 0;
10506 
10507  /* "subsurfaceTransportFunctions.pyx":400
10508  * #check some sizes
10509  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10510  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
10511  * assert nDOF_trial_element == nSpace + 1
10512  * #temporaries
10513  */
10514  #ifndef CYTHON_WITHOUT_ASSERTIONS
10515  if (unlikely(!Py_OptimizeFlag)) {
10516  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10517  __Pyx_GOTREF(__pyx_t_1);
10518  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
10519  __Pyx_GOTREF(__pyx_t_4);
10520  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10521  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10522  __Pyx_GOTREF(__pyx_t_1);
10523  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
10524  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10525  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10526  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
10527  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10528  if (unlikely(!__pyx_t_6)) {
10529  PyErr_SetNone(PyExc_AssertionError);
10530  __PYX_ERR(0, 400, __pyx_L1_error)
10531  }
10532  }
10533  #endif
10534 
10535  /* "subsurfaceTransportFunctions.pyx":399
10536  * """
10537  * #check some sizes
10538  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10539  * assert q.shape[1] == nSpace+1
10540  * assert nDOF_trial_element == nSpace + 1
10541  */
10542  }
10543  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10544 
10545  /* "subsurfaceTransportFunctions.pyx":401
10546  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10547  * assert q.shape[1] == nSpace+1
10548  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
10549  * #temporaries
10550  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10551  */
10552  #ifndef CYTHON_WITHOUT_ASSERTIONS
10553  if (unlikely(!Py_OptimizeFlag)) {
10554  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
10555  PyErr_SetNone(PyExc_AssertionError);
10556  __PYX_ERR(0, 401, __pyx_L1_error)
10557  }
10558  }
10559  #endif
10560 
10561  /* "subsurfaceTransportFunctions.pyx":404
10562  * #temporaries
10563  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10564  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
10565  *
10566  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
10567  */
10568  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
10569 
10570  /* "subsurfaceTransportFunctions.pyx":409
10571  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
10572  * #for averaging/integration weights
10573  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
10574  *
10575  * #loop through and evaluate
10576  */
10577  __pyx_t_7 = (__pyx_v_nSpace + 1.);
10578  if (unlikely(__pyx_t_7 == 0)) {
10579  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10580  __PYX_ERR(0, 409, __pyx_L1_error)
10581  }
10582  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
10583 
10584  /* "subsurfaceTransportFunctions.pyx":412
10585  *
10586  * #loop through and evaluate
10587  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10588  * matID = elementMaterialTypes[eN]
10589  * for j in range(nDOF_trial_element):
10590  */
10591  __pyx_t_8 = __pyx_v_nElements_global;
10592  __pyx_t_9 = __pyx_t_8;
10593  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
10594  __pyx_v_eN = __pyx_t_10;
10595 
10596  /* "subsurfaceTransportFunctions.pyx":413
10597  * #loop through and evaluate
10598  * for eN in range(nElements_global):
10599  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
10600  * for j in range(nDOF_trial_element):
10601  * u_j = u_dof[u_l2g[eN,j]]
10602  */
10603  __pyx_t_11 = __pyx_v_eN;
10604  __pyx_t_12 = -1;
10605  if (__pyx_t_11 < 0) {
10606  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
10607  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
10608  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_12 = 0;
10609  if (unlikely(__pyx_t_12 != -1)) {
10610  __Pyx_RaiseBufferIndexError(__pyx_t_12);
10611  __PYX_ERR(0, 413, __pyx_L1_error)
10612  }
10613  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
10614 
10615  /* "subsurfaceTransportFunctions.pyx":414
10616  * for eN in range(nElements_global):
10617  * matID = elementMaterialTypes[eN]
10618  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
10619  * u_j = u_dof[u_l2g[eN,j]]
10620  * q_u[eN,j] = u_j
10621  */
10622  __pyx_t_12 = __pyx_v_nDOF_trial_element;
10623  __pyx_t_13 = __pyx_t_12;
10624  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
10625  __pyx_v_j = __pyx_t_14;
10626 
10627  /* "subsurfaceTransportFunctions.pyx":415
10628  * matID = elementMaterialTypes[eN]
10629  * for j in range(nDOF_trial_element):
10630  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
10631  * q_u[eN,j] = u_j
10632  *
10633  */
10634  __pyx_t_11 = __pyx_v_eN;
10635  __pyx_t_15 = __pyx_v_j;
10636  __pyx_t_16 = -1;
10637  if (__pyx_t_11 < 0) {
10638  __pyx_t_11 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
10639  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10640  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_16 = 0;
10641  if (__pyx_t_15 < 0) {
10642  __pyx_t_15 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
10643  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
10644  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_16 = 1;
10645  if (unlikely(__pyx_t_16 != -1)) {
10646  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10647  __PYX_ERR(0, 415, __pyx_L1_error)
10648  }
10649  __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
10650  __pyx_t_16 = -1;
10651  if (__pyx_t_17 < 0) {
10652  __pyx_t_17 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
10653  if (unlikely(__pyx_t_17 < 0)) __pyx_t_16 = 0;
10654  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_16 = 0;
10655  if (unlikely(__pyx_t_16 != -1)) {
10656  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10657  __PYX_ERR(0, 415, __pyx_L1_error)
10658  }
10659  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_u_dof.diminfo[0].strides));
10660 
10661  /* "subsurfaceTransportFunctions.pyx":416
10662  * for j in range(nDOF_trial_element):
10663  * u_j = u_dof[u_l2g[eN,j]]
10664  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
10665  *
10666  * #VGM evaluation
10667  */
10668  __pyx_t_15 = __pyx_v_eN;
10669  __pyx_t_11 = __pyx_v_j;
10670  __pyx_t_16 = -1;
10671  if (__pyx_t_15 < 0) {
10672  __pyx_t_15 += __pyx_pybuffernd_q_u.diminfo[0].shape;
10673  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10674  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_16 = 0;
10675  if (__pyx_t_11 < 0) {
10676  __pyx_t_11 += __pyx_pybuffernd_q_u.diminfo[1].shape;
10677  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
10678  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_16 = 1;
10679  if (unlikely(__pyx_t_16 != -1)) {
10680  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10681  __PYX_ERR(0, 416, __pyx_L1_error)
10682  }
10683  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
10684 
10685  /* "subsurfaceTransportFunctions.pyx":419
10686  *
10687  * #VGM evaluation
10688  * psiC = -u_j # <<<<<<<<<<<<<<
10689  * m = 1.0 - 1.0/n[matID]
10690  * thetaS = thetaR[matID] + thetaSR[matID]
10691  */
10692  __pyx_v_psiC = (-__pyx_v_u_j);
10693 
10694  /* "subsurfaceTransportFunctions.pyx":420
10695  * #VGM evaluation
10696  * psiC = -u_j
10697  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
10698  * thetaS = thetaR[matID] + thetaSR[matID]
10699  * if psiC > 0.0:
10700  */
10701  __pyx_t_11 = __pyx_v_matID;
10702  __pyx_t_16 = -1;
10703  if (__pyx_t_11 < 0) {
10704  __pyx_t_11 += __pyx_pybuffernd_n.diminfo[0].shape;
10705  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10706  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10707  if (unlikely(__pyx_t_16 != -1)) {
10708  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10709  __PYX_ERR(0, 420, __pyx_L1_error)
10710  }
10711  __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_n.diminfo[0].strides));
10712  if (unlikely(__pyx_t_18 == 0)) {
10713  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10714  __PYX_ERR(0, 420, __pyx_L1_error)
10715  }
10716  __pyx_v_m = (1.0 - (1.0 / __pyx_t_18));
10717 
10718  /* "subsurfaceTransportFunctions.pyx":421
10719  * psiC = -u_j
10720  * m = 1.0 - 1.0/n[matID]
10721  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
10722  * if psiC > 0.0:
10723  * pcBar = alpha[matID]*psiC
10724  */
10725  __pyx_t_11 = __pyx_v_matID;
10726  __pyx_t_16 = -1;
10727  if (__pyx_t_11 < 0) {
10728  __pyx_t_11 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10729  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10730  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_16 = 0;
10731  if (unlikely(__pyx_t_16 != -1)) {
10732  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10733  __PYX_ERR(0, 421, __pyx_L1_error)
10734  }
10735  __pyx_t_15 = __pyx_v_matID;
10736  __pyx_t_16 = -1;
10737  if (__pyx_t_15 < 0) {
10738  __pyx_t_15 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10739  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10740  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10741  if (unlikely(__pyx_t_16 != -1)) {
10742  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10743  __PYX_ERR(0, 421, __pyx_L1_error)
10744  }
10745  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
10746 
10747  /* "subsurfaceTransportFunctions.pyx":422
10748  * m = 1.0 - 1.0/n[matID]
10749  * thetaS = thetaR[matID] + thetaSR[matID]
10750  * if psiC > 0.0: # <<<<<<<<<<<<<<
10751  * pcBar = alpha[matID]*psiC
10752  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10753  */
10754  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
10755  if (__pyx_t_6) {
10756 
10757  /* "subsurfaceTransportFunctions.pyx":423
10758  * thetaS = thetaR[matID] + thetaSR[matID]
10759  * if psiC > 0.0:
10760  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
10761  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10762  * pcBar_nM1 = pcBar_nM2*pcBar
10763  */
10764  __pyx_t_15 = __pyx_v_matID;
10765  __pyx_t_16 = -1;
10766  if (__pyx_t_15 < 0) {
10767  __pyx_t_15 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10768  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10769  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10770  if (unlikely(__pyx_t_16 != -1)) {
10771  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10772  __PYX_ERR(0, 423, __pyx_L1_error)
10773  }
10774  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
10775 
10776  /* "subsurfaceTransportFunctions.pyx":424
10777  * if psiC > 0.0:
10778  * pcBar = alpha[matID]*psiC
10779  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
10780  * pcBar_nM1 = pcBar_nM2*pcBar
10781  * pcBar_n = pcBar_nM1*pcBar
10782  */
10783  __pyx_t_15 = __pyx_v_matID;
10784  __pyx_t_16 = -1;
10785  if (__pyx_t_15 < 0) {
10786  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[0].shape;
10787  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10788  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10789  if (unlikely(__pyx_t_16 != -1)) {
10790  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10791  __PYX_ERR(0, 424, __pyx_L1_error)
10792  }
10793  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
10794 
10795  /* "subsurfaceTransportFunctions.pyx":425
10796  * pcBar = alpha[matID]*psiC
10797  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10798  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
10799  * pcBar_n = pcBar_nM1*pcBar
10800  * onePlus_pcBar_n = 1.0 + pcBar_n
10801  */
10802  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
10803 
10804  /* "subsurfaceTransportFunctions.pyx":426
10805  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10806  * pcBar_nM1 = pcBar_nM2*pcBar
10807  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
10808  * onePlus_pcBar_n = 1.0 + pcBar_n
10809  *
10810  */
10811  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
10812 
10813  /* "subsurfaceTransportFunctions.pyx":427
10814  * pcBar_nM1 = pcBar_nM2*pcBar
10815  * pcBar_n = pcBar_nM1*pcBar
10816  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
10817  *
10818  * sBar = pow(onePlus_pcBar_n,-m)
10819  */
10820  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
10821 
10822  /* "subsurfaceTransportFunctions.pyx":429
10823  * onePlus_pcBar_n = 1.0 + pcBar_n
10824  *
10825  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
10826  * # using -mn = 1-n
10827  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10828  */
10829  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
10830 
10831  /* "subsurfaceTransportFunctions.pyx":431
10832  * sBar = pow(onePlus_pcBar_n,-m)
10833  * # using -mn = 1-n
10834  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
10835  *
10836  * vBar = 1.0-pcBar_nM1*sBar
10837  */
10838  __pyx_t_15 = __pyx_v_matID;
10839  __pyx_t_16 = -1;
10840  if (__pyx_t_15 < 0) {
10841  __pyx_t_15 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10842  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10843  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10844  if (unlikely(__pyx_t_16 != -1)) {
10845  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10846  __PYX_ERR(0, 431, __pyx_L1_error)
10847  }
10848  __pyx_t_11 = __pyx_v_matID;
10849  __pyx_t_16 = -1;
10850  if (__pyx_t_11 < 0) {
10851  __pyx_t_11 += __pyx_pybuffernd_n.diminfo[0].shape;
10852  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10853  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10854  if (unlikely(__pyx_t_16 != -1)) {
10855  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10856  __PYX_ERR(0, 431, __pyx_L1_error)
10857  }
10858  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
10859  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10860  __PYX_ERR(0, 431, __pyx_L1_error)
10861  }
10862  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
10863 
10864  /* "subsurfaceTransportFunctions.pyx":433
10865  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10866  *
10867  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
10868  * vBar2 = vBar*vBar
10869  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10870  */
10871  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
10872 
10873  /* "subsurfaceTransportFunctions.pyx":434
10874  *
10875  * vBar = 1.0-pcBar_nM1*sBar
10876  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
10877  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10878  *
10879  */
10880  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
10881 
10882  /* "subsurfaceTransportFunctions.pyx":435
10883  * vBar = 1.0-pcBar_nM1*sBar
10884  * vBar2 = vBar*vBar
10885  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
10886  *
10887  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10888  */
10889  __pyx_t_11 = __pyx_v_matID;
10890  __pyx_t_16 = -1;
10891  if (__pyx_t_11 < 0) {
10892  __pyx_t_11 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10893  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10894  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10895  if (unlikely(__pyx_t_16 != -1)) {
10896  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10897  __PYX_ERR(0, 435, __pyx_L1_error)
10898  }
10899  __pyx_t_15 = __pyx_v_matID;
10900  __pyx_t_16 = -1;
10901  if (__pyx_t_15 < 0) {
10902  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[0].shape;
10903  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10904  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10905  if (unlikely(__pyx_t_16 != -1)) {
10906  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10907  __PYX_ERR(0, 435, __pyx_L1_error)
10908  }
10909  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
10910 
10911  /* "subsurfaceTransportFunctions.pyx":437
10912  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10913  *
10914  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
10915  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10916  *
10917  */
10918  __pyx_t_15 = __pyx_v_matID;
10919  __pyx_t_16 = -1;
10920  if (__pyx_t_15 < 0) {
10921  __pyx_t_15 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10922  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10923  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10924  if (unlikely(__pyx_t_16 != -1)) {
10925  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10926  __PYX_ERR(0, 437, __pyx_L1_error)
10927  }
10928  __pyx_t_11 = __pyx_v_matID;
10929  __pyx_t_16 = -1;
10930  if (__pyx_t_11 < 0) {
10931  __pyx_t_11 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10932  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10933  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_16 = 0;
10934  if (unlikely(__pyx_t_16 != -1)) {
10935  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10936  __PYX_ERR(0, 437, __pyx_L1_error)
10937  }
10938  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
10939 
10940  /* "subsurfaceTransportFunctions.pyx":438
10941  *
10942  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10943  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
10944  *
10945  * sqrt_sBar = sqrt(sBar)
10946  */
10947  __pyx_t_11 = __pyx_v_matID;
10948  __pyx_t_16 = -1;
10949  if (__pyx_t_11 < 0) {
10950  __pyx_t_11 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10951  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10952  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10953  if (unlikely(__pyx_t_16 != -1)) {
10954  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10955  __PYX_ERR(0, 438, __pyx_L1_error)
10956  }
10957  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
10958 
10959  /* "subsurfaceTransportFunctions.pyx":440
10960  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10961  *
10962  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
10963  * KWr= sqrt_sBar*vBar2
10964  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10965  */
10966  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
10967 
10968  /* "subsurfaceTransportFunctions.pyx":441
10969  *
10970  * sqrt_sBar = sqrt(sBar)
10971  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
10972  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10973  * else:
10974  */
10975  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
10976 
10977  /* "subsurfaceTransportFunctions.pyx":442
10978  * sqrt_sBar = sqrt(sBar)
10979  * KWr= sqrt_sBar*vBar2
10980  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
10981  * else:
10982  * thetaW = thetaS
10983  */
10984  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
10985  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10986  __PYX_ERR(0, 442, __pyx_L1_error)
10987  }
10988  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
10989 
10990  /* "subsurfaceTransportFunctions.pyx":422
10991  * m = 1.0 - 1.0/n[matID]
10992  * thetaS = thetaR[matID] + thetaSR[matID]
10993  * if psiC > 0.0: # <<<<<<<<<<<<<<
10994  * pcBar = alpha[matID]*psiC
10995  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10996  */
10997  goto __pyx_L9;
10998  }
10999 
11000  /* "subsurfaceTransportFunctions.pyx":444
11001  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
11002  * else:
11003  * thetaW = thetaS # <<<<<<<<<<<<<<
11004  * DthetaW_DpsiC = 0.0
11005  * KWr = 1.0
11006  */
11007  /*else*/ {
11008  __pyx_v_thetaW = __pyx_v_thetaS;
11009 
11010  /* "subsurfaceTransportFunctions.pyx":445
11011  * else:
11012  * thetaW = thetaS
11013  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
11014  * KWr = 1.0
11015  * DKWr_DpsiC = 0.0
11016  */
11017  __pyx_v_DthetaW_DpsiC = 0.0;
11018 
11019  /* "subsurfaceTransportFunctions.pyx":446
11020  * thetaW = thetaS
11021  * DthetaW_DpsiC = 0.0
11022  * KWr = 1.0 # <<<<<<<<<<<<<<
11023  * DKWr_DpsiC = 0.0
11024  * #
11025  */
11026  __pyx_v_KWr = 1.0;
11027 
11028  /* "subsurfaceTransportFunctions.pyx":447
11029  * DthetaW_DpsiC = 0.0
11030  * KWr = 1.0
11031  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
11032  * #
11033  * rhom = rho*exp(beta*u_j)
11034  */
11035  __pyx_v_DKWr_DpsiC = 0.0;
11036  }
11037  __pyx_L9:;
11038 
11039  /* "subsurfaceTransportFunctions.pyx":449
11040  * DKWr_DpsiC = 0.0
11041  * #
11042  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
11043  * drhom= beta*rhom
11044  * q_mass[eN,j] = rhom*thetaW
11045  */
11046  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
11047 
11048  /* "subsurfaceTransportFunctions.pyx":450
11049  * #
11050  * rhom = rho*exp(beta*u_j)
11051  * drhom= beta*rhom # <<<<<<<<<<<<<<
11052  * q_mass[eN,j] = rhom*thetaW
11053  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11054  */
11055  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
11056 
11057  /* "subsurfaceTransportFunctions.pyx":451
11058  * rhom = rho*exp(beta*u_j)
11059  * drhom= beta*rhom
11060  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
11061  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11062  *
11063  */
11064  __pyx_t_11 = __pyx_v_eN;
11065  __pyx_t_15 = __pyx_v_j;
11066  __pyx_t_16 = -1;
11067  if (__pyx_t_11 < 0) {
11068  __pyx_t_11 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
11069  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11070  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_16 = 0;
11071  if (__pyx_t_15 < 0) {
11072  __pyx_t_15 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
11073  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11074  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_16 = 1;
11075  if (unlikely(__pyx_t_16 != -1)) {
11076  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11077  __PYX_ERR(0, 451, __pyx_L1_error)
11078  }
11079  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
11080 
11081  /* "subsurfaceTransportFunctions.pyx":452
11082  * drhom= beta*rhom
11083  * q_mass[eN,j] = rhom*thetaW
11084  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
11085  *
11086  * q_kr[eN,j] = KWr
11087  */
11088  __pyx_t_15 = __pyx_v_eN;
11089  __pyx_t_11 = __pyx_v_j;
11090  __pyx_t_16 = -1;
11091  if (__pyx_t_15 < 0) {
11092  __pyx_t_15 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
11093  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11094  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_16 = 0;
11095  if (__pyx_t_11 < 0) {
11096  __pyx_t_11 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
11097  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11098  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_16 = 1;
11099  if (unlikely(__pyx_t_16 != -1)) {
11100  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11101  __PYX_ERR(0, 452, __pyx_L1_error)
11102  }
11103  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
11104 
11105  /* "subsurfaceTransportFunctions.pyx":454
11106  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11107  *
11108  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
11109  * q_dkr[eN,j]= -DKWr_DpsiC
11110  *
11111  */
11112  __pyx_t_11 = __pyx_v_eN;
11113  __pyx_t_15 = __pyx_v_j;
11114  __pyx_t_16 = -1;
11115  if (__pyx_t_11 < 0) {
11116  __pyx_t_11 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
11117  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11118  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_16 = 0;
11119  if (__pyx_t_15 < 0) {
11120  __pyx_t_15 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
11121  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11122  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_16 = 1;
11123  if (unlikely(__pyx_t_16 != -1)) {
11124  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11125  __PYX_ERR(0, 454, __pyx_L1_error)
11126  }
11127  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
11128 
11129  /* "subsurfaceTransportFunctions.pyx":455
11130  *
11131  * q_kr[eN,j] = KWr
11132  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
11133  *
11134  * #j
11135  */
11136  __pyx_t_15 = __pyx_v_eN;
11137  __pyx_t_11 = __pyx_v_j;
11138  __pyx_t_16 = -1;
11139  if (__pyx_t_15 < 0) {
11140  __pyx_t_15 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
11141  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11142  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_16 = 0;
11143  if (__pyx_t_11 < 0) {
11144  __pyx_t_11 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
11145  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11146  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_16 = 1;
11147  if (unlikely(__pyx_t_16 != -1)) {
11148  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11149  __PYX_ERR(0, 455, __pyx_L1_error)
11150  }
11151  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
11152  }
11153  }
11154 
11155  /* "subsurfaceTransportFunctions.pyx":461
11156  *
11157  * #now upwind kr
11158  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
11159  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11160  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11161  */
11162  __pyx_t_8 = __pyx_v_nElements_global;
11163  __pyx_t_9 = __pyx_t_8;
11164  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
11165  __pyx_v_eN = __pyx_t_10;
11166 
11167  /* "subsurfaceTransportFunctions.pyx":462
11168  * #now upwind kr
11169  * for eN in range(nElements_global):
11170  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
11171  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11172  * #potential assumes slight compressibility
11173  */
11174  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11175  __Pyx_GOTREF(__pyx_t_5);
11176  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11177  __Pyx_GOTREF(__pyx_t_1);
11178  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11179  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11180  __Pyx_GOTREF(__pyx_t_5);
11181  __pyx_t_4 = NULL;
11182  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11183  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11184  if (likely(__pyx_t_4)) {
11185  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11186  __Pyx_INCREF(__pyx_t_4);
11187  __Pyx_INCREF(function);
11188  __Pyx_DECREF_SET(__pyx_t_1, function);
11189  }
11190  }
11191  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
11192  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11193  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11194  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11195  __Pyx_GOTREF(__pyx_t_2);
11196  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11197  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11198  __Pyx_GOTREF(__pyx_t_1);
11199  __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11200  __Pyx_GOTREF(__pyx_t_5);
11201  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11202  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11203  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
11204  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11205  __pyx_v_u_eN = __pyx_t_7;
11206 
11207  /* "subsurfaceTransportFunctions.pyx":463
11208  * for eN in range(nElements_global):
11209  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11210  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
11211  * #potential assumes slight compressibility
11212  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
11213  */
11214  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11215  __Pyx_GOTREF(__pyx_t_1);
11216  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11217  __Pyx_GOTREF(__pyx_t_2);
11218  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11219  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11220  __Pyx_GOTREF(__pyx_t_1);
11221  __pyx_t_4 = NULL;
11222  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11223  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
11224  if (likely(__pyx_t_4)) {
11225  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11226  __Pyx_INCREF(__pyx_t_4);
11227  __Pyx_INCREF(function);
11228  __Pyx_DECREF_SET(__pyx_t_2, function);
11229  }
11230  }
11231  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
11232  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11233  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11234  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error)
11235  __Pyx_GOTREF(__pyx_t_5);
11236  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11237  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11238  __Pyx_GOTREF(__pyx_t_2);
11239  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11240  __Pyx_GOTREF(__pyx_t_1);
11241  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11242  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11243  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
11244  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11245  __pyx_v_kr_eN = __pyx_t_7;
11246 
11247  /* "subsurfaceTransportFunctions.pyx":465
11248  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11249  * #potential assumes slight compressibility
11250  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
11251  *
11252  *
11253  */
11254  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11255  __Pyx_GOTREF(__pyx_t_1);
11256  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11257  __Pyx_GOTREF(__pyx_t_5);
11258  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11259  __Pyx_GOTREF(__pyx_t_4);
11260  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11261  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11262  __Pyx_GOTREF(__pyx_t_5);
11263  __pyx_t_19 = NULL;
11264  __pyx_t_12 = 0;
11265  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11266  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4);
11267  if (likely(__pyx_t_19)) {
11268  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11269  __Pyx_INCREF(__pyx_t_19);
11270  __Pyx_INCREF(function);
11271  __Pyx_DECREF_SET(__pyx_t_4, function);
11272  __pyx_t_12 = 1;
11273  }
11274  }
11275  #if CYTHON_FAST_PYCALL
11276  if (PyFunction_Check(__pyx_t_4)) {
11277  PyObject *__pyx_temp[3] = {__pyx_t_19, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11278  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11279  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
11280  __Pyx_GOTREF(__pyx_t_2);
11281  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11282  } else
11283  #endif
11284  #if CYTHON_FAST_PYCCALL
11285  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11286  PyObject *__pyx_temp[3] = {__pyx_t_19, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11287  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11288  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
11289  __Pyx_GOTREF(__pyx_t_2);
11290  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11291  } else
11292  #endif
11293  {
11294  __pyx_t_20 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 465, __pyx_L1_error)
11295  __Pyx_GOTREF(__pyx_t_20);
11296  if (__pyx_t_19) {
11297  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
11298  }
11299  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11300  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11301  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_12, ((PyObject *)__pyx_v_gravity));
11302  __Pyx_GIVEREF(__pyx_t_5);
11303  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_12, __pyx_t_5);
11304  __pyx_t_5 = 0;
11305  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11306  __Pyx_GOTREF(__pyx_t_2);
11307  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11308  }
11309  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11310  __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11311  __Pyx_GOTREF(__pyx_t_4);
11312  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11313  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11314  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
11315  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11316  __pyx_v_phi_eN = __pyx_t_7;
11317 
11318  /* "subsurfaceTransportFunctions.pyx":469
11319  *
11320  * #loop over faces to upwind
11321  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
11322  * #by default eN is upwind
11323  * q_kr_up[eN,ebN] = kr_eN
11324  */
11325  __pyx_t_12 = __pyx_v_nElementBoundaries_element;
11326  __pyx_t_13 = __pyx_t_12;
11327  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
11328  __pyx_v_ebN = __pyx_t_14;
11329 
11330  /* "subsurfaceTransportFunctions.pyx":471
11331  * for ebN in range(nElementBoundaries_element):
11332  * #by default eN is upwind
11333  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
11334  * eN_neighbor = elementNeighborsArray[eN,ebN]
11335  * if eN_neighbor >= 0:
11336  */
11337  __pyx_t_11 = __pyx_v_eN;
11338  __pyx_t_15 = __pyx_v_ebN;
11339  __pyx_t_16 = -1;
11340  if (__pyx_t_11 < 0) {
11341  __pyx_t_11 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11342  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11343  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_16 = 0;
11344  if (__pyx_t_15 < 0) {
11345  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11346  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11347  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_16 = 1;
11348  if (unlikely(__pyx_t_16 != -1)) {
11349  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11350  __PYX_ERR(0, 471, __pyx_L1_error)
11351  }
11352  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
11353 
11354  /* "subsurfaceTransportFunctions.pyx":472
11355  * #by default eN is upwind
11356  * q_kr_up[eN,ebN] = kr_eN
11357  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
11358  * if eN_neighbor >= 0:
11359  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11360  */
11361  __pyx_t_15 = __pyx_v_eN;
11362  __pyx_t_11 = __pyx_v_ebN;
11363  __pyx_t_16 = -1;
11364  if (__pyx_t_15 < 0) {
11365  __pyx_t_15 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
11366  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11367  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_16 = 0;
11368  if (__pyx_t_11 < 0) {
11369  __pyx_t_11 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
11370  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11371  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_16 = 1;
11372  if (unlikely(__pyx_t_16 != -1)) {
11373  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11374  __PYX_ERR(0, 472, __pyx_L1_error)
11375  }
11376  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
11377 
11378  /* "subsurfaceTransportFunctions.pyx":473
11379  * q_kr_up[eN,ebN] = kr_eN
11380  * eN_neighbor = elementNeighborsArray[eN,ebN]
11381  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11382  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11383  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11384  */
11385  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
11386  if (__pyx_t_6) {
11387 
11388  /* "subsurfaceTransportFunctions.pyx":474
11389  * eN_neighbor = elementNeighborsArray[eN,ebN]
11390  * if eN_neighbor >= 0:
11391  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11392  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11393  * #potential, assumes slight compressibility
11394  */
11395  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11396  __Pyx_GOTREF(__pyx_t_2);
11397  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11398  __Pyx_GOTREF(__pyx_t_1);
11399  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11400  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11401  __Pyx_GOTREF(__pyx_t_2);
11402  __pyx_t_20 = NULL;
11403  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11404  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
11405  if (likely(__pyx_t_20)) {
11406  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11407  __Pyx_INCREF(__pyx_t_20);
11408  __Pyx_INCREF(function);
11409  __Pyx_DECREF_SET(__pyx_t_1, function);
11410  }
11411  }
11412  __pyx_t_4 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
11413  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11414  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11415  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
11416  __Pyx_GOTREF(__pyx_t_4);
11417  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11418  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11419  __Pyx_GOTREF(__pyx_t_1);
11420  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11421  __Pyx_GOTREF(__pyx_t_2);
11422  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11423  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11424  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
11425  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11426  __pyx_v_u_neig = __pyx_t_7;
11427 
11428  /* "subsurfaceTransportFunctions.pyx":475
11429  * if eN_neighbor >= 0:
11430  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11431  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11432  * #potential, assumes slight compressibility
11433  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11434  */
11435  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11436  __Pyx_GOTREF(__pyx_t_1);
11437  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11438  __Pyx_GOTREF(__pyx_t_4);
11439  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11440  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11441  __Pyx_GOTREF(__pyx_t_1);
11442  __pyx_t_20 = NULL;
11443  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11444  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
11445  if (likely(__pyx_t_20)) {
11446  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11447  __Pyx_INCREF(__pyx_t_20);
11448  __Pyx_INCREF(function);
11449  __Pyx_DECREF_SET(__pyx_t_4, function);
11450  }
11451  }
11452  __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
11453  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11454  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11455  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
11456  __Pyx_GOTREF(__pyx_t_2);
11457  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11458  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11459  __Pyx_GOTREF(__pyx_t_4);
11460  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11461  __Pyx_GOTREF(__pyx_t_1);
11462  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11463  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11464  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error)
11465  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11466  __pyx_v_kr_neig = __pyx_t_7;
11467 
11468  /* "subsurfaceTransportFunctions.pyx":477
11469  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11470  * #potential, assumes slight compressibility
11471  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
11472  *
11473  * if phi_eN < phi_neig: #neighbor is upwind
11474  */
11475  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11476  __Pyx_GOTREF(__pyx_t_1);
11477  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11478  __Pyx_GOTREF(__pyx_t_2);
11479  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 477, __pyx_L1_error)
11480  __Pyx_GOTREF(__pyx_t_20);
11481  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11482  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11483  __Pyx_GOTREF(__pyx_t_2);
11484  __pyx_t_5 = NULL;
11485  __pyx_t_16 = 0;
11486  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
11487  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_20);
11488  if (likely(__pyx_t_5)) {
11489  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
11490  __Pyx_INCREF(__pyx_t_5);
11491  __Pyx_INCREF(function);
11492  __Pyx_DECREF_SET(__pyx_t_20, function);
11493  __pyx_t_16 = 1;
11494  }
11495  }
11496  #if CYTHON_FAST_PYCALL
11497  if (PyFunction_Check(__pyx_t_20)) {
11498  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11499  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11500  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11501  __Pyx_GOTREF(__pyx_t_4);
11502  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11503  } else
11504  #endif
11505  #if CYTHON_FAST_PYCCALL
11506  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
11507  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11508  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11509  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11510  __Pyx_GOTREF(__pyx_t_4);
11511  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11512  } else
11513  #endif
11514  {
11515  __pyx_t_19 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 477, __pyx_L1_error)
11516  __Pyx_GOTREF(__pyx_t_19);
11517  if (__pyx_t_5) {
11518  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_5); __pyx_t_5 = NULL;
11519  }
11520  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11521  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11522  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_16, ((PyObject *)__pyx_v_gravity));
11523  __Pyx_GIVEREF(__pyx_t_2);
11524  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_16, __pyx_t_2);
11525  __pyx_t_2 = 0;
11526  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11527  __Pyx_GOTREF(__pyx_t_4);
11528  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
11529  }
11530  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11531  __pyx_t_20 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 477, __pyx_L1_error)
11532  __Pyx_GOTREF(__pyx_t_20);
11533  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11534  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11535  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
11536  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11537  __pyx_v_phi_neig = __pyx_t_7;
11538 
11539  /* "subsurfaceTransportFunctions.pyx":479
11540  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11541  *
11542  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11543  * q_kr_up[eN,ebN] = kr_neig
11544  *
11545  */
11546  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
11547  if (__pyx_t_6) {
11548 
11549  /* "subsurfaceTransportFunctions.pyx":480
11550  *
11551  * if phi_eN < phi_neig: #neighbor is upwind
11552  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
11553  *
11554  * #neighbor
11555  */
11556  __pyx_t_11 = __pyx_v_eN;
11557  __pyx_t_15 = __pyx_v_ebN;
11558  __pyx_t_16 = -1;
11559  if (__pyx_t_11 < 0) {
11560  __pyx_t_11 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11561  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11562  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_16 = 0;
11563  if (__pyx_t_15 < 0) {
11564  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11565  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11566  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_16 = 1;
11567  if (unlikely(__pyx_t_16 != -1)) {
11568  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11569  __PYX_ERR(0, 480, __pyx_L1_error)
11570  }
11571  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
11572 
11573  /* "subsurfaceTransportFunctions.pyx":479
11574  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11575  *
11576  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11577  * q_kr_up[eN,ebN] = kr_neig
11578  *
11579  */
11580  }
11581 
11582  /* "subsurfaceTransportFunctions.pyx":473
11583  * q_kr_up[eN,ebN] = kr_eN
11584  * eN_neighbor = elementNeighborsArray[eN,ebN]
11585  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11586  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11587  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11588  */
11589  }
11590  }
11591  }
11592 
11593  /* "subsurfaceTransportFunctions.pyx":359
11594  *
11595  *
11596  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
11597  * double beta,
11598  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
11599  */
11600 
11601  /* function exit code */
11602  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11603  goto __pyx_L0;
11604  __pyx_L1_error:;
11605  __Pyx_XDECREF(__pyx_t_1);
11606  __Pyx_XDECREF(__pyx_t_2);
11607  __Pyx_XDECREF(__pyx_t_4);
11608  __Pyx_XDECREF(__pyx_t_5);
11609  __Pyx_XDECREF(__pyx_t_19);
11610  __Pyx_XDECREF(__pyx_t_20);
11611  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11612  __Pyx_PyThreadState_declare
11613  __Pyx_PyThreadState_assign
11614  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11615  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11616  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11617  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11618  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11619  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11620  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11621  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11622  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11623  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11624  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11625  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11631  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11632  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11633  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11634  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
11635  __pyx_r = NULL;
11636  goto __pyx_L2;
11637  __pyx_L0:;
11638  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11639  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11644  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11645  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11646  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11647  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11648  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11649  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11650  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11651  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11656  __pyx_L2:;
11657  __Pyx_XDECREF(__pyx_v_q);
11658  __Pyx_XGIVEREF(__pyx_r);
11659  __Pyx_RefNannyFinishContext();
11660  return __pyx_r;
11661 }
11662 
11663 /* "subsurfaceTransportFunctions.pyx":486
11664  * #eN for upwind
11665  *
11666  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11667  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11668  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11669  */
11670 
11671 /* Python wrapper */
11672 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11673 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11674 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
11675 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11676  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11677  PyArrayObject *__pyx_v_rowptr = 0;
11678  PyArrayObject *__pyx_v_colind = 0;
11679  int __pyx_v_nSpace;
11680  int __pyx_v_nElements_global;
11681  int __pyx_v_nElementBoundaries_element;
11682  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11683  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11684  int __pyx_v_nDOF_test_element;
11685  PyArrayObject *__pyx_v_q_u = 0;
11686  PyArrayObject *__pyx_v_q_grad_u = 0;
11687  PyArrayObject *__pyx_v_q_grad_w = 0;
11688  PyArrayObject *__pyx_v_q_detJ = 0;
11689  PyArrayObject *__pyx_v_q_m = 0;
11690  PyArrayObject *__pyx_v_q_mt = 0;
11691  PyArrayObject *__pyx_v_q_r = 0;
11692  PyArrayObject *__pyx_v_q_kr = 0;
11693  PyArrayObject *__pyx_v_q_kr_up = 0;
11694  PyArrayObject *__pyx_v_q_flin = 0;
11695  PyArrayObject *__pyx_v_q_alin = 0;
11696  PyArrayObject *__pyx_v_elementResidual = 0;
11697  int __pyx_lineno = 0;
11698  const char *__pyx_filename = NULL;
11699  int __pyx_clineno = 0;
11700  PyObject *__pyx_r = 0;
11701  __Pyx_RefNannyDeclarations
11702  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
11703  {
11704  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
11705  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11706  if (unlikely(__pyx_kwds)) {
11707  Py_ssize_t kw_args;
11708  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11709  switch (pos_args) {
11710  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11711  CYTHON_FALLTHROUGH;
11712  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11713  CYTHON_FALLTHROUGH;
11714  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11715  CYTHON_FALLTHROUGH;
11716  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11717  CYTHON_FALLTHROUGH;
11718  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11719  CYTHON_FALLTHROUGH;
11720  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11721  CYTHON_FALLTHROUGH;
11722  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11723  CYTHON_FALLTHROUGH;
11724  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11725  CYTHON_FALLTHROUGH;
11726  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11727  CYTHON_FALLTHROUGH;
11728  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11729  CYTHON_FALLTHROUGH;
11730  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11731  CYTHON_FALLTHROUGH;
11732  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11733  CYTHON_FALLTHROUGH;
11734  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11735  CYTHON_FALLTHROUGH;
11736  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11737  CYTHON_FALLTHROUGH;
11738  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11739  CYTHON_FALLTHROUGH;
11740  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11741  CYTHON_FALLTHROUGH;
11742  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11743  CYTHON_FALLTHROUGH;
11744  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11745  CYTHON_FALLTHROUGH;
11746  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11747  CYTHON_FALLTHROUGH;
11748  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11749  CYTHON_FALLTHROUGH;
11750  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11751  CYTHON_FALLTHROUGH;
11752  case 0: break;
11753  default: goto __pyx_L5_argtuple_error;
11754  }
11755  kw_args = PyDict_Size(__pyx_kwds);
11756  switch (pos_args) {
11757  case 0:
11758  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
11759  else goto __pyx_L5_argtuple_error;
11760  CYTHON_FALLTHROUGH;
11761  case 1:
11762  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
11763  else {
11764  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); __PYX_ERR(0, 486, __pyx_L3_error)
11765  }
11766  CYTHON_FALLTHROUGH;
11767  case 2:
11768  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
11769  else {
11770  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); __PYX_ERR(0, 486, __pyx_L3_error)
11771  }
11772  CYTHON_FALLTHROUGH;
11773  case 3:
11774  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
11775  else {
11776  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); __PYX_ERR(0, 486, __pyx_L3_error)
11777  }
11778  CYTHON_FALLTHROUGH;
11779  case 4:
11780  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
11781  else {
11782  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); __PYX_ERR(0, 486, __pyx_L3_error)
11783  }
11784  CYTHON_FALLTHROUGH;
11785  case 5:
11786  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
11787  else {
11788  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); __PYX_ERR(0, 486, __pyx_L3_error)
11789  }
11790  CYTHON_FALLTHROUGH;
11791  case 6:
11792  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
11793  else {
11794  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); __PYX_ERR(0, 486, __pyx_L3_error)
11795  }
11796  CYTHON_FALLTHROUGH;
11797  case 7:
11798  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
11799  else {
11800  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); __PYX_ERR(0, 486, __pyx_L3_error)
11801  }
11802  CYTHON_FALLTHROUGH;
11803  case 8:
11804  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
11805  else {
11806  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); __PYX_ERR(0, 486, __pyx_L3_error)
11807  }
11808  CYTHON_FALLTHROUGH;
11809  case 9:
11810  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
11811  else {
11812  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); __PYX_ERR(0, 486, __pyx_L3_error)
11813  }
11814  CYTHON_FALLTHROUGH;
11815  case 10:
11816  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
11817  else {
11818  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); __PYX_ERR(0, 486, __pyx_L3_error)
11819  }
11820  CYTHON_FALLTHROUGH;
11821  case 11:
11822  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
11823  else {
11824  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); __PYX_ERR(0, 486, __pyx_L3_error)
11825  }
11826  CYTHON_FALLTHROUGH;
11827  case 12:
11828  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
11829  else {
11830  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); __PYX_ERR(0, 486, __pyx_L3_error)
11831  }
11832  CYTHON_FALLTHROUGH;
11833  case 13:
11834  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
11835  else {
11836  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); __PYX_ERR(0, 486, __pyx_L3_error)
11837  }
11838  CYTHON_FALLTHROUGH;
11839  case 14:
11840  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
11841  else {
11842  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); __PYX_ERR(0, 486, __pyx_L3_error)
11843  }
11844  CYTHON_FALLTHROUGH;
11845  case 15:
11846  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
11847  else {
11848  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); __PYX_ERR(0, 486, __pyx_L3_error)
11849  }
11850  CYTHON_FALLTHROUGH;
11851  case 16:
11852  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
11853  else {
11854  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); __PYX_ERR(0, 486, __pyx_L3_error)
11855  }
11856  CYTHON_FALLTHROUGH;
11857  case 17:
11858  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
11859  else {
11860  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); __PYX_ERR(0, 486, __pyx_L3_error)
11861  }
11862  CYTHON_FALLTHROUGH;
11863  case 18:
11864  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
11865  else {
11866  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); __PYX_ERR(0, 486, __pyx_L3_error)
11867  }
11868  CYTHON_FALLTHROUGH;
11869  case 19:
11870  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
11871  else {
11872  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); __PYX_ERR(0, 486, __pyx_L3_error)
11873  }
11874  CYTHON_FALLTHROUGH;
11875  case 20:
11876  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
11877  else {
11878  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); __PYX_ERR(0, 486, __pyx_L3_error)
11879  }
11880  }
11881  if (unlikely(kw_args > 0)) {
11882  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) __PYX_ERR(0, 486, __pyx_L3_error)
11883  }
11884  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
11885  goto __pyx_L5_argtuple_error;
11886  } else {
11887  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11888  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11889  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11890  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11891  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11892  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11893  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11894  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11895  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11896  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11897  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11898  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11899  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11900  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11901  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11902  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11903  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11904  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11905  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11906  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11907  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11908  }
11909  __pyx_v_gravity = ((PyArrayObject *)values[0]);
11910  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
11911  __pyx_v_colind = ((PyArrayObject *)values[2]);
11912  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error)
11913  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error)
11914  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L3_error)
11915  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
11916  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
11917  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L3_error)
11918  __pyx_v_q_u = ((PyArrayObject *)values[9]);
11919  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
11920  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
11921  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
11922  __pyx_v_q_m = ((PyArrayObject *)values[13]);
11923  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
11924  __pyx_v_q_r = ((PyArrayObject *)values[15]);
11925  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
11926  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
11927  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
11928  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
11929  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
11930  }
11931  goto __pyx_L4_argument_unpacking_done;
11932  __pyx_L5_argtuple_error:;
11933  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error)
11934  __pyx_L3_error:;
11935  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
11936  __Pyx_RefNannyFinishContext();
11937  return NULL;
11938  __pyx_L4_argument_unpacking_done:;
11939  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 486, __pyx_L1_error)
11940  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 487, __pyx_L1_error)
11941  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 488, __pyx_L1_error)
11942  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 493, __pyx_L1_error)
11943  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 494, __pyx_L1_error)
11944  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 497, __pyx_L1_error)
11945  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
11946  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
11947  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
11948  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
11949  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
11950  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
11951  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 505, __pyx_L1_error)
11952  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
11953  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 509, __pyx_L1_error)
11954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 510, __pyx_L1_error)
11955  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) __PYX_ERR(0, 512, __pyx_L1_error)
11956  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
11957 
11958  /* function exit code */
11959  goto __pyx_L0;
11960  __pyx_L1_error:;
11961  __pyx_r = NULL;
11962  __pyx_L0:;
11963  __Pyx_RefNannyFinishContext();
11964  return __pyx_r;
11965 }
11966 
11967 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual) {
11968  CYTHON_UNUSED int __pyx_v_upwindFlag;
11969  PyObject *__pyx_v_q = NULL;
11970  int __pyx_v_nnz;
11971  int __pyx_v_eN;
11972  int __pyx_v_ii;
11973  int __pyx_v_I;
11974  int __pyx_v_i;
11975  int __pyx_v_ebN;
11976  PyArrayObject *__pyx_v_a_up = 0;
11977  PyArrayObject *__pyx_v_f_up = 0;
11978  double __pyx_v_nAvgWeight;
11979  double __pyx_v_weight;
11980  double __pyx_v_volFactor;
11981  double __pyx_v_volume;
11982  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
11983  __Pyx_Buffer __pyx_pybuffer_a_up;
11984  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
11985  __Pyx_Buffer __pyx_pybuffer_colind;
11986  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
11987  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
11988  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
11989  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
11990  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
11991  __Pyx_Buffer __pyx_pybuffer_elementResidual;
11992  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
11993  __Pyx_Buffer __pyx_pybuffer_f_up;
11994  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
11995  __Pyx_Buffer __pyx_pybuffer_gravity;
11996  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
11997  __Pyx_Buffer __pyx_pybuffer_q_alin;
11998  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
11999  __Pyx_Buffer __pyx_pybuffer_q_detJ;
12000  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
12001  __Pyx_Buffer __pyx_pybuffer_q_flin;
12002  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
12003  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
12004  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
12005  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
12006  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
12007  __Pyx_Buffer __pyx_pybuffer_q_kr;
12008  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
12009  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
12010  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
12011  __Pyx_Buffer __pyx_pybuffer_q_m;
12012  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
12013  __Pyx_Buffer __pyx_pybuffer_q_mt;
12014  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
12015  __Pyx_Buffer __pyx_pybuffer_q_r;
12016  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
12017  __Pyx_Buffer __pyx_pybuffer_q_u;
12018  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
12019  __Pyx_Buffer __pyx_pybuffer_rowptr;
12020  PyObject *__pyx_r = NULL;
12021  __Pyx_RefNannyDeclarations
12022  PyObject *__pyx_t_1 = NULL;
12023  PyObject *__pyx_t_2 = NULL;
12024  Py_ssize_t __pyx_t_3;
12025  PyObject *__pyx_t_4 = NULL;
12026  PyObject *__pyx_t_5 = NULL;
12027  int __pyx_t_6;
12028  Py_ssize_t __pyx_t_7;
12029  int __pyx_t_8;
12030  PyObject *__pyx_t_9 = NULL;
12031  PyArrayObject *__pyx_t_10 = NULL;
12032  PyArrayObject *__pyx_t_11 = NULL;
12033  double __pyx_t_12;
12034  int __pyx_t_13;
12035  int __pyx_t_14;
12036  Py_ssize_t __pyx_t_15;
12037  int __pyx_t_16;
12038  int __pyx_t_17;
12039  int __pyx_t_18;
12040  int __pyx_t_19;
12041  Py_ssize_t __pyx_t_20;
12042  Py_ssize_t __pyx_t_21;
12043  int __pyx_t_22;
12044  int __pyx_t_23;
12045  int __pyx_t_24;
12046  int __pyx_t_25;
12047  int __pyx_t_26;
12048  int __pyx_t_27;
12049  Py_ssize_t __pyx_t_28;
12050  Py_ssize_t __pyx_t_29;
12051  Py_ssize_t __pyx_t_30;
12052  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_31;
12053  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_32;
12054  int __pyx_t_33;
12055  Py_ssize_t __pyx_t_34;
12056  Py_ssize_t __pyx_t_35;
12057  Py_ssize_t __pyx_t_36;
12058  Py_ssize_t __pyx_t_37;
12059  Py_ssize_t __pyx_t_38;
12060  int __pyx_lineno = 0;
12061  const char *__pyx_filename = NULL;
12062  int __pyx_clineno = 0;
12063  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
12064  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
12065  __pyx_pybuffer_a_up.refcount = 0;
12066  __pyx_pybuffernd_a_up.data = NULL;
12067  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
12068  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
12069  __pyx_pybuffer_f_up.refcount = 0;
12070  __pyx_pybuffernd_f_up.data = NULL;
12071  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
12072  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
12073  __pyx_pybuffer_gravity.refcount = 0;
12074  __pyx_pybuffernd_gravity.data = NULL;
12075  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
12076  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
12077  __pyx_pybuffer_rowptr.refcount = 0;
12078  __pyx_pybuffernd_rowptr.data = NULL;
12079  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
12080  __pyx_pybuffer_colind.pybuffer.buf = NULL;
12081  __pyx_pybuffer_colind.refcount = 0;
12082  __pyx_pybuffernd_colind.data = NULL;
12083  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
12084  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
12085  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
12086  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
12087  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
12088  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
12089  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
12090  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
12091  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
12092  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
12093  __pyx_pybuffer_q_u.refcount = 0;
12094  __pyx_pybuffernd_q_u.data = NULL;
12095  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
12096  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
12097  __pyx_pybuffer_q_grad_u.refcount = 0;
12098  __pyx_pybuffernd_q_grad_u.data = NULL;
12099  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
12100  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
12101  __pyx_pybuffer_q_grad_w.refcount = 0;
12102  __pyx_pybuffernd_q_grad_w.data = NULL;
12103  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
12104  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
12105  __pyx_pybuffer_q_detJ.refcount = 0;
12106  __pyx_pybuffernd_q_detJ.data = NULL;
12107  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
12108  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
12109  __pyx_pybuffer_q_m.refcount = 0;
12110  __pyx_pybuffernd_q_m.data = NULL;
12111  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
12112  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
12113  __pyx_pybuffer_q_mt.refcount = 0;
12114  __pyx_pybuffernd_q_mt.data = NULL;
12115  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
12116  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
12117  __pyx_pybuffer_q_r.refcount = 0;
12118  __pyx_pybuffernd_q_r.data = NULL;
12119  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
12120  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
12121  __pyx_pybuffer_q_kr.refcount = 0;
12122  __pyx_pybuffernd_q_kr.data = NULL;
12123  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
12124  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
12125  __pyx_pybuffer_q_kr_up.refcount = 0;
12126  __pyx_pybuffernd_q_kr_up.data = NULL;
12127  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
12128  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
12129  __pyx_pybuffer_q_flin.refcount = 0;
12130  __pyx_pybuffernd_q_flin.data = NULL;
12131  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
12132  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
12133  __pyx_pybuffer_q_alin.refcount = 0;
12134  __pyx_pybuffernd_q_alin.data = NULL;
12135  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
12136  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
12137  __pyx_pybuffer_elementResidual.refcount = 0;
12138  __pyx_pybuffernd_elementResidual.data = NULL;
12139  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
12140  {
12141  __Pyx_BufFmt_StackElem __pyx_stack[1];
12142  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12143  }
12144  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
12145  {
12146  __Pyx_BufFmt_StackElem __pyx_stack[1];
12147  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12148  }
12149  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
12150  {
12151  __Pyx_BufFmt_StackElem __pyx_stack[1];
12152  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12153  }
12154  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
12155  {
12156  __Pyx_BufFmt_StackElem __pyx_stack[1];
12157  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12158  }
12159  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
12160  {
12161  __Pyx_BufFmt_StackElem __pyx_stack[1];
12162  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12163  }
12164  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
12165  {
12166  __Pyx_BufFmt_StackElem __pyx_stack[1];
12167  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12168  }
12169  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
12170  {
12171  __Pyx_BufFmt_StackElem __pyx_stack[1];
12172  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12173  }
12174  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
12175  {
12176  __Pyx_BufFmt_StackElem __pyx_stack[1];
12177  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12178  }
12179  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
12180  {
12181  __Pyx_BufFmt_StackElem __pyx_stack[1];
12182  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12183  }
12184  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
12185  {
12186  __Pyx_BufFmt_StackElem __pyx_stack[1];
12187  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12188  }
12189  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
12190  {
12191  __Pyx_BufFmt_StackElem __pyx_stack[1];
12192  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12193  }
12194  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
12195  {
12196  __Pyx_BufFmt_StackElem __pyx_stack[1];
12197  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12198  }
12199  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
12200  {
12201  __Pyx_BufFmt_StackElem __pyx_stack[1];
12202  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12203  }
12204  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
12205  {
12206  __Pyx_BufFmt_StackElem __pyx_stack[1];
12207  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12208  }
12209  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
12210  {
12211  __Pyx_BufFmt_StackElem __pyx_stack[1];
12212  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12213  }
12214  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
12215  {
12216  __Pyx_BufFmt_StackElem __pyx_stack[1];
12217  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12218  }
12219  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
12220  {
12221  __Pyx_BufFmt_StackElem __pyx_stack[1];
12222  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12223  }
12224  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
12225 
12226  /* "subsurfaceTransportFunctions.pyx":527
12227  *
12228  * """
12229  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
12230  * #check some sizes
12231  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12232  */
12233  __pyx_v_upwindFlag = 1;
12234 
12235  /* "subsurfaceTransportFunctions.pyx":529
12236  * cdef int upwindFlag = 1
12237  * #check some sizes
12238  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12239  * assert q.shape[1] == nSpace+1
12240  * assert nDOF_test_element == nSpace+1
12241  */
12242  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12243  __Pyx_GOTREF(__pyx_t_1);
12244  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
12245  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
12246  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
12247  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
12248  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
12249  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
12250  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
12251  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
12252  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
12253  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
12254  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
12255  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
12256  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
12257  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
12258  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
12259  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12260  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12261  for (;;) {
12262  if (__pyx_t_3 >= 5) break;
12263  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12264  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 529, __pyx_L1_error)
12265  #else
12266  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12267  __Pyx_GOTREF(__pyx_t_1);
12268  #endif
12269  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
12270  __pyx_t_1 = 0;
12271 
12272  /* "subsurfaceTransportFunctions.pyx":530
12273  * #check some sizes
12274  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12275  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
12276  * assert nDOF_test_element == nSpace+1
12277  * cdef int nnz = rowptr[nSpace]
12278  */
12279  #ifndef CYTHON_WITHOUT_ASSERTIONS
12280  if (unlikely(!Py_OptimizeFlag)) {
12281  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12282  __Pyx_GOTREF(__pyx_t_1);
12283  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
12284  __Pyx_GOTREF(__pyx_t_4);
12285  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12286  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12287  __Pyx_GOTREF(__pyx_t_1);
12288  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
12289  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12290  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12291  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 530, __pyx_L1_error)
12292  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12293  if (unlikely(!__pyx_t_6)) {
12294  PyErr_SetNone(PyExc_AssertionError);
12295  __PYX_ERR(0, 530, __pyx_L1_error)
12296  }
12297  }
12298  #endif
12299 
12300  /* "subsurfaceTransportFunctions.pyx":529
12301  * cdef int upwindFlag = 1
12302  * #check some sizes
12303  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12304  * assert q.shape[1] == nSpace+1
12305  * assert nDOF_test_element == nSpace+1
12306  */
12307  }
12308  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12309 
12310  /* "subsurfaceTransportFunctions.pyx":531
12311  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12312  * assert q.shape[1] == nSpace+1
12313  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
12314  * cdef int nnz = rowptr[nSpace]
12315  * #temporaries
12316  */
12317  #ifndef CYTHON_WITHOUT_ASSERTIONS
12318  if (unlikely(!Py_OptimizeFlag)) {
12319  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
12320  PyErr_SetNone(PyExc_AssertionError);
12321  __PYX_ERR(0, 531, __pyx_L1_error)
12322  }
12323  }
12324  #endif
12325 
12326  /* "subsurfaceTransportFunctions.pyx":532
12327  * assert q.shape[1] == nSpace+1
12328  * assert nDOF_test_element == nSpace+1
12329  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
12330  * #temporaries
12331  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12332  */
12333  __pyx_t_7 = __pyx_v_nSpace;
12334  __pyx_t_8 = -1;
12335  if (__pyx_t_7 < 0) {
12336  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12337  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
12338  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
12339  if (unlikely(__pyx_t_8 != -1)) {
12340  __Pyx_RaiseBufferIndexError(__pyx_t_8);
12341  __PYX_ERR(0, 532, __pyx_L1_error)
12342  }
12343  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12344 
12345  /* "subsurfaceTransportFunctions.pyx":536
12346  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12347  * cdef int eN,eN_neighbor,ii,I,i,ebN
12348  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
12349  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12350  * #for averaging/integration weights
12351  */
12352  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12353  __Pyx_GOTREF(__pyx_t_5);
12354  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
12355  __Pyx_GOTREF(__pyx_t_1);
12356  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12357  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12358  __Pyx_GOTREF(__pyx_t_5);
12359  __pyx_t_4 = NULL;
12360  __pyx_t_8 = 0;
12361  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
12362  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
12363  if (likely(__pyx_t_4)) {
12364  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12365  __Pyx_INCREF(__pyx_t_4);
12366  __Pyx_INCREF(function);
12367  __Pyx_DECREF_SET(__pyx_t_1, function);
12368  __pyx_t_8 = 1;
12369  }
12370  }
12371  #if CYTHON_FAST_PYCALL
12372  if (PyFunction_Check(__pyx_t_1)) {
12373  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12374  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12375  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12376  __Pyx_GOTREF(__pyx_t_2);
12377  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12378  } else
12379  #endif
12380  #if CYTHON_FAST_PYCCALL
12381  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
12382  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12383  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12384  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12385  __Pyx_GOTREF(__pyx_t_2);
12386  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12387  } else
12388  #endif
12389  {
12390  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
12391  __Pyx_GOTREF(__pyx_t_9);
12392  if (__pyx_t_4) {
12393  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
12394  }
12395  __Pyx_GIVEREF(__pyx_t_5);
12396  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
12397  __Pyx_INCREF(__pyx_n_s_d);
12398  __Pyx_GIVEREF(__pyx_n_s_d);
12399  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
12400  __pyx_t_5 = 0;
12401  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12402  __Pyx_GOTREF(__pyx_t_2);
12403  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12404  }
12405  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12406  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 536, __pyx_L1_error)
12407  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
12408  {
12409  __Pyx_BufFmt_StackElem __pyx_stack[1];
12410  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12411  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
12412  __PYX_ERR(0, 536, __pyx_L1_error)
12413  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
12414  }
12415  }
12416  __pyx_t_10 = 0;
12417  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
12418  __pyx_t_2 = 0;
12419 
12420  /* "subsurfaceTransportFunctions.pyx":537
12421  * cdef int eN,eN_neighbor,ii,I,i,ebN
12422  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
12423  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
12424  * #for averaging/integration weights
12425  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12426  */
12427  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12428  __Pyx_GOTREF(__pyx_t_1);
12429  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
12430  __Pyx_GOTREF(__pyx_t_9);
12431  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12432  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12433  __Pyx_GOTREF(__pyx_t_1);
12434  __pyx_t_5 = NULL;
12435  __pyx_t_8 = 0;
12436  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
12437  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
12438  if (likely(__pyx_t_5)) {
12439  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
12440  __Pyx_INCREF(__pyx_t_5);
12441  __Pyx_INCREF(function);
12442  __Pyx_DECREF_SET(__pyx_t_9, function);
12443  __pyx_t_8 = 1;
12444  }
12445  }
12446  #if CYTHON_FAST_PYCALL
12447  if (PyFunction_Check(__pyx_t_9)) {
12448  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12449  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12450  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12451  __Pyx_GOTREF(__pyx_t_2);
12452  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12453  } else
12454  #endif
12455  #if CYTHON_FAST_PYCCALL
12456  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
12457  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12458  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12459  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12460  __Pyx_GOTREF(__pyx_t_2);
12461  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12462  } else
12463  #endif
12464  {
12465  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
12466  __Pyx_GOTREF(__pyx_t_4);
12467  if (__pyx_t_5) {
12468  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12469  }
12470  __Pyx_GIVEREF(__pyx_t_1);
12471  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
12472  __Pyx_INCREF(__pyx_n_s_d);
12473  __Pyx_GIVEREF(__pyx_n_s_d);
12474  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
12475  __pyx_t_1 = 0;
12476  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12477  __Pyx_GOTREF(__pyx_t_2);
12478  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12479  }
12480  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12481  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 537, __pyx_L1_error)
12482  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12483  {
12484  __Pyx_BufFmt_StackElem __pyx_stack[1];
12485  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12486  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12487  __PYX_ERR(0, 537, __pyx_L1_error)
12488  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12489  }
12490  }
12491  __pyx_t_11 = 0;
12492  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12493  __pyx_t_2 = 0;
12494 
12495  /* "subsurfaceTransportFunctions.pyx":539
12496  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12497  * #for averaging/integration weights
12498  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12499  * cdef double weight=1.0,volFactor = 1.0
12500  * if nSpace == 2:
12501  */
12502  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12503  if (unlikely(__pyx_t_12 == 0)) {
12504  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12505  __PYX_ERR(0, 539, __pyx_L1_error)
12506  }
12507  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12508 
12509  /* "subsurfaceTransportFunctions.pyx":540
12510  * #for averaging/integration weights
12511  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12512  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12513  * if nSpace == 2:
12514  * volFactor = 0.5
12515  */
12516  __pyx_v_weight = 1.0;
12517  __pyx_v_volFactor = 1.0;
12518 
12519  /* "subsurfaceTransportFunctions.pyx":541
12520  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12521  * cdef double weight=1.0,volFactor = 1.0
12522  * if nSpace == 2: # <<<<<<<<<<<<<<
12523  * volFactor = 0.5
12524  * if nSpace == 3:
12525  */
12526  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12527  if (__pyx_t_6) {
12528 
12529  /* "subsurfaceTransportFunctions.pyx":542
12530  * cdef double weight=1.0,volFactor = 1.0
12531  * if nSpace == 2:
12532  * volFactor = 0.5 # <<<<<<<<<<<<<<
12533  * if nSpace == 3:
12534  * volFactor = 1.0/6.0
12535  */
12536  __pyx_v_volFactor = 0.5;
12537 
12538  /* "subsurfaceTransportFunctions.pyx":541
12539  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12540  * cdef double weight=1.0,volFactor = 1.0
12541  * if nSpace == 2: # <<<<<<<<<<<<<<
12542  * volFactor = 0.5
12543  * if nSpace == 3:
12544  */
12545  }
12546 
12547  /* "subsurfaceTransportFunctions.pyx":543
12548  * if nSpace == 2:
12549  * volFactor = 0.5
12550  * if nSpace == 3: # <<<<<<<<<<<<<<
12551  * volFactor = 1.0/6.0
12552  * #
12553  */
12554  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12555  if (__pyx_t_6) {
12556 
12557  /* "subsurfaceTransportFunctions.pyx":544
12558  * volFactor = 0.5
12559  * if nSpace == 3:
12560  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12561  * #
12562  * for eN in range(nElements_global):
12563  */
12564  __pyx_v_volFactor = (1.0 / 6.0);
12565 
12566  /* "subsurfaceTransportFunctions.pyx":543
12567  * if nSpace == 2:
12568  * volFactor = 0.5
12569  * if nSpace == 3: # <<<<<<<<<<<<<<
12570  * volFactor = 1.0/6.0
12571  * #
12572  */
12573  }
12574 
12575  /* "subsurfaceTransportFunctions.pyx":546
12576  * volFactor = 1.0/6.0
12577  * #
12578  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12579  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12580  * weight = nAvgWeight*volume
12581  */
12582  __pyx_t_8 = __pyx_v_nElements_global;
12583  __pyx_t_13 = __pyx_t_8;
12584  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12585  __pyx_v_eN = __pyx_t_14;
12586 
12587  /* "subsurfaceTransportFunctions.pyx":547
12588  * #
12589  * for eN in range(nElements_global):
12590  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12591  * weight = nAvgWeight*volume
12592  *
12593  */
12594  __pyx_t_7 = __pyx_v_eN;
12595  __pyx_t_15 = 0;
12596  __pyx_t_16 = -1;
12597  if (__pyx_t_7 < 0) {
12598  __pyx_t_7 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12599  if (unlikely(__pyx_t_7 < 0)) __pyx_t_16 = 0;
12600  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
12601  if (__pyx_t_15 < 0) {
12602  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12603  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
12604  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
12605  if (unlikely(__pyx_t_16 != -1)) {
12606  __Pyx_RaiseBufferIndexError(__pyx_t_16);
12607  __PYX_ERR(0, 547, __pyx_L1_error)
12608  }
12609  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12610 
12611  /* "subsurfaceTransportFunctions.pyx":548
12612  * for eN in range(nElements_global):
12613  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12614  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12615  *
12616  * for i in range(nDOF_test_element):
12617  */
12618  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12619 
12620  /* "subsurfaceTransportFunctions.pyx":550
12621  * weight = nAvgWeight*volume
12622  *
12623  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12624  * #nodal quadrature so diagonal
12625  * ##mass
12626  */
12627  __pyx_t_16 = __pyx_v_nDOF_test_element;
12628  __pyx_t_17 = __pyx_t_16;
12629  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
12630  __pyx_v_i = __pyx_t_18;
12631 
12632  /* "subsurfaceTransportFunctions.pyx":553
12633  * #nodal quadrature so diagonal
12634  * ##mass
12635  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
12636  * ##sources
12637  * elementResidual[eN,i] += weight*q_r[eN,i]
12638  */
12639  __pyx_t_15 = __pyx_v_eN;
12640  __pyx_t_7 = __pyx_v_i;
12641  __pyx_t_19 = -1;
12642  if (__pyx_t_15 < 0) {
12643  __pyx_t_15 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
12644  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 0;
12645  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_19 = 0;
12646  if (__pyx_t_7 < 0) {
12647  __pyx_t_7 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
12648  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 1;
12649  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_19 = 1;
12650  if (unlikely(__pyx_t_19 != -1)) {
12651  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12652  __PYX_ERR(0, 553, __pyx_L1_error)
12653  }
12654  __pyx_t_20 = __pyx_v_eN;
12655  __pyx_t_21 = __pyx_v_i;
12656  __pyx_t_19 = -1;
12657  if (__pyx_t_20 < 0) {
12658  __pyx_t_20 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12659  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
12660  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_19 = 0;
12661  if (__pyx_t_21 < 0) {
12662  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12663  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 1;
12664  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_19 = 1;
12665  if (unlikely(__pyx_t_19 != -1)) {
12666  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12667  __PYX_ERR(0, 553, __pyx_L1_error)
12668  }
12669  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
12670 
12671  /* "subsurfaceTransportFunctions.pyx":555
12672  * elementResidual[eN,i] += weight*q_mt[eN,i]
12673  * ##sources
12674  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
12675  *
12676  * #have to actually compute loop over other nodes for stiffness terms
12677  */
12678  __pyx_t_7 = __pyx_v_eN;
12679  __pyx_t_15 = __pyx_v_i;
12680  __pyx_t_19 = -1;
12681  if (__pyx_t_7 < 0) {
12682  __pyx_t_7 += __pyx_pybuffernd_q_r.diminfo[0].shape;
12683  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 0;
12684  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_19 = 0;
12685  if (__pyx_t_15 < 0) {
12686  __pyx_t_15 += __pyx_pybuffernd_q_r.diminfo[1].shape;
12687  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 1;
12688  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_19 = 1;
12689  if (unlikely(__pyx_t_19 != -1)) {
12690  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12691  __PYX_ERR(0, 555, __pyx_L1_error)
12692  }
12693  __pyx_t_21 = __pyx_v_eN;
12694  __pyx_t_20 = __pyx_v_i;
12695  __pyx_t_19 = -1;
12696  if (__pyx_t_21 < 0) {
12697  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12698  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 0;
12699  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_19 = 0;
12700  if (__pyx_t_20 < 0) {
12701  __pyx_t_20 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12702  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 1;
12703  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_19 = 1;
12704  if (unlikely(__pyx_t_19 != -1)) {
12705  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12706  __PYX_ERR(0, 555, __pyx_L1_error)
12707  }
12708  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_r.diminfo[1].strides)));
12709 
12710  /* "subsurfaceTransportFunctions.pyx":558
12711  *
12712  * #have to actually compute loop over other nodes for stiffness terms
12713  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12714  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12715  * for ii in range(nnz):
12716  */
12717  __pyx_t_19 = __pyx_v_nElementBoundaries_element;
12718  __pyx_t_22 = __pyx_t_19;
12719  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
12720  __pyx_v_ebN = __pyx_t_23;
12721 
12722  /* "subsurfaceTransportFunctions.pyx":560
12723  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
12724  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12725  * for ii in range(nnz): # <<<<<<<<<<<<<<
12726  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12727  * for I in range(nSpace):
12728  */
12729  __pyx_t_24 = __pyx_v_nnz;
12730  __pyx_t_25 = __pyx_t_24;
12731  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12732  __pyx_v_ii = __pyx_t_26;
12733 
12734  /* "subsurfaceTransportFunctions.pyx":561
12735  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12736  * for ii in range(nnz):
12737  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12738  * for I in range(nSpace):
12739  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12740  */
12741  __pyx_t_15 = __pyx_v_eN;
12742  __pyx_t_7 = __pyx_v_ebN;
12743  __pyx_t_20 = __pyx_v_ii;
12744  __pyx_t_27 = -1;
12745  if (__pyx_t_15 < 0) {
12746  __pyx_t_15 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
12747  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 0;
12748  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_27 = 0;
12749  if (__pyx_t_7 < 0) {
12750  __pyx_t_7 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
12751  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 1;
12752  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_27 = 1;
12753  if (__pyx_t_20 < 0) {
12754  __pyx_t_20 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
12755  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 2;
12756  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_27 = 2;
12757  if (unlikely(__pyx_t_27 != -1)) {
12758  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12759  __PYX_ERR(0, 561, __pyx_L1_error)
12760  }
12761  __pyx_t_21 = __pyx_v_eN;
12762  __pyx_t_28 = __pyx_v_ebN;
12763  __pyx_t_27 = -1;
12764  if (__pyx_t_21 < 0) {
12765  __pyx_t_21 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12766  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 0;
12767  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_27 = 0;
12768  if (__pyx_t_28 < 0) {
12769  __pyx_t_28 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12770  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 1;
12771  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_27 = 1;
12772  if (unlikely(__pyx_t_27 != -1)) {
12773  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12774  __PYX_ERR(0, 561, __pyx_L1_error)
12775  }
12776  __pyx_t_29 = __pyx_v_ii;
12777  __pyx_t_27 = -1;
12778  if (__pyx_t_29 < 0) {
12779  __pyx_t_29 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12780  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12781  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_27 = 0;
12782  if (unlikely(__pyx_t_27 != -1)) {
12783  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12784  __PYX_ERR(0, 561, __pyx_L1_error)
12785  }
12786  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12787  }
12788 
12789  /* "subsurfaceTransportFunctions.pyx":562
12790  * for ii in range(nnz):
12791  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12792  * for I in range(nSpace): # <<<<<<<<<<<<<<
12793  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12794  * #
12795  */
12796  __pyx_t_24 = __pyx_v_nSpace;
12797  __pyx_t_25 = __pyx_t_24;
12798  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12799  __pyx_v_I = __pyx_t_26;
12800 
12801  /* "subsurfaceTransportFunctions.pyx":563
12802  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12803  * for I in range(nSpace):
12804  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12805  * #
12806  * #accumulate advection and stiffness contributions
12807  */
12808  __pyx_t_28 = __pyx_v_eN;
12809  __pyx_t_21 = __pyx_v_ebN;
12810  __pyx_t_20 = __pyx_v_I;
12811  __pyx_t_27 = -1;
12812  if (__pyx_t_28 < 0) {
12813  __pyx_t_28 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
12814  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12815  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_27 = 0;
12816  if (__pyx_t_21 < 0) {
12817  __pyx_t_21 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
12818  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 1;
12819  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_27 = 1;
12820  if (__pyx_t_20 < 0) {
12821  __pyx_t_20 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
12822  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 2;
12823  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_27 = 2;
12824  if (unlikely(__pyx_t_27 != -1)) {
12825  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12826  __PYX_ERR(0, 563, __pyx_L1_error)
12827  }
12828  __pyx_t_7 = __pyx_v_eN;
12829  __pyx_t_15 = __pyx_v_ebN;
12830  __pyx_t_27 = -1;
12831  if (__pyx_t_7 < 0) {
12832  __pyx_t_7 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12833  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 0;
12834  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_27 = 0;
12835  if (__pyx_t_15 < 0) {
12836  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12837  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 1;
12838  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_27 = 1;
12839  if (unlikely(__pyx_t_27 != -1)) {
12840  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12841  __PYX_ERR(0, 563, __pyx_L1_error)
12842  }
12843  __pyx_t_29 = __pyx_v_I;
12844  __pyx_t_27 = -1;
12845  if (__pyx_t_29 < 0) {
12846  __pyx_t_29 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12847  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12848  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_27 = 0;
12849  if (unlikely(__pyx_t_27 != -1)) {
12850  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12851  __PYX_ERR(0, 563, __pyx_L1_error)
12852  }
12853  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12854  }
12855 
12856  /* "subsurfaceTransportFunctions.pyx":566
12857  * #
12858  * #accumulate advection and stiffness contributions
12859  * for I in range(nSpace): # <<<<<<<<<<<<<<
12860  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12861  * for ii in range(rowptr[I],rowptr[I+1]):
12862  */
12863  __pyx_t_24 = __pyx_v_nSpace;
12864  __pyx_t_25 = __pyx_t_24;
12865  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12866  __pyx_v_I = __pyx_t_26;
12867 
12868  /* "subsurfaceTransportFunctions.pyx":567
12869  * #accumulate advection and stiffness contributions
12870  * for I in range(nSpace):
12871  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12872  * for ii in range(rowptr[I],rowptr[I+1]):
12873  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12874  */
12875  __pyx_t_15 = __pyx_v_I;
12876  __pyx_t_27 = -1;
12877  if (__pyx_t_15 < 0) {
12878  __pyx_t_15 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12879  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 0;
12880  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_27 = 0;
12881  if (unlikely(__pyx_t_27 != -1)) {
12882  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12883  __PYX_ERR(0, 567, __pyx_L1_error)
12884  }
12885  __pyx_t_7 = __pyx_v_eN;
12886  __pyx_t_20 = __pyx_v_ebN;
12887  __pyx_t_21 = __pyx_v_i;
12888  __pyx_t_28 = __pyx_v_I;
12889  __pyx_t_27 = -1;
12890  if (__pyx_t_7 < 0) {
12891  __pyx_t_7 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12892  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 0;
12893  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_27 = 0;
12894  if (__pyx_t_20 < 0) {
12895  __pyx_t_20 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12896  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 1;
12897  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_27 = 1;
12898  if (__pyx_t_21 < 0) {
12899  __pyx_t_21 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12900  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 2;
12901  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_27 = 2;
12902  if (__pyx_t_28 < 0) {
12903  __pyx_t_28 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12904  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 3;
12905  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_27 = 3;
12906  if (unlikely(__pyx_t_27 != -1)) {
12907  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12908  __PYX_ERR(0, 567, __pyx_L1_error)
12909  }
12910  __pyx_t_29 = __pyx_v_eN;
12911  __pyx_t_30 = __pyx_v_i;
12912  __pyx_t_27 = -1;
12913  if (__pyx_t_29 < 0) {
12914  __pyx_t_29 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12915  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12916  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_27 = 0;
12917  if (__pyx_t_30 < 0) {
12918  __pyx_t_30 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12919  if (unlikely(__pyx_t_30 < 0)) __pyx_t_27 = 1;
12920  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_27 = 1;
12921  if (unlikely(__pyx_t_27 != -1)) {
12922  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12923  __PYX_ERR(0, 567, __pyx_L1_error)
12924  }
12925  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
12926 
12927  /* "subsurfaceTransportFunctions.pyx":568
12928  * for I in range(nSpace):
12929  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12930  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
12931  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12932  * #I
12933  */
12934  __pyx_t_28 = (__pyx_v_I + 1);
12935  __pyx_t_27 = -1;
12936  if (__pyx_t_28 < 0) {
12937  __pyx_t_28 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12938  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12939  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_27 = 0;
12940  if (unlikely(__pyx_t_27 != -1)) {
12941  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12942  __PYX_ERR(0, 568, __pyx_L1_error)
12943  }
12944  __pyx_t_31 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12945  __pyx_t_28 = __pyx_v_I;
12946  __pyx_t_27 = -1;
12947  if (__pyx_t_28 < 0) {
12948  __pyx_t_28 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12949  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12950  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_27 = 0;
12951  if (unlikely(__pyx_t_27 != -1)) {
12952  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12953  __PYX_ERR(0, 568, __pyx_L1_error)
12954  }
12955  __pyx_t_32 = __pyx_t_31;
12956  for (__pyx_t_27 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_27 < __pyx_t_32; __pyx_t_27+=1) {
12957  __pyx_v_ii = __pyx_t_27;
12958 
12959  /* "subsurfaceTransportFunctions.pyx":569
12960  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12961  * for ii in range(rowptr[I],rowptr[I+1]):
12962  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12963  * #I
12964  * #j
12965  */
12966  __pyx_t_21 = __pyx_v_ii;
12967  __pyx_t_33 = -1;
12968  if (__pyx_t_21 < 0) {
12969  __pyx_t_21 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12970  if (unlikely(__pyx_t_21 < 0)) __pyx_t_33 = 0;
12971  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_33 = 0;
12972  if (unlikely(__pyx_t_33 != -1)) {
12973  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12974  __PYX_ERR(0, 569, __pyx_L1_error)
12975  }
12976  __pyx_t_20 = __pyx_v_ii;
12977  __pyx_t_33 = -1;
12978  if (__pyx_t_20 < 0) {
12979  __pyx_t_20 += __pyx_pybuffernd_colind.diminfo[0].shape;
12980  if (unlikely(__pyx_t_20 < 0)) __pyx_t_33 = 0;
12981  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_33 = 0;
12982  if (unlikely(__pyx_t_33 != -1)) {
12983  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12984  __PYX_ERR(0, 569, __pyx_L1_error)
12985  }
12986  __pyx_t_7 = __pyx_v_eN;
12987  __pyx_t_15 = __pyx_v_ebN;
12988  __pyx_t_30 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_colind.diminfo[0].strides));
12989  __pyx_t_33 = -1;
12990  if (__pyx_t_7 < 0) {
12991  __pyx_t_7 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
12992  if (unlikely(__pyx_t_7 < 0)) __pyx_t_33 = 0;
12993  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_33 = 0;
12994  if (__pyx_t_15 < 0) {
12995  __pyx_t_15 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
12996  if (unlikely(__pyx_t_15 < 0)) __pyx_t_33 = 1;
12997  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_33 = 1;
12998  if (__pyx_t_30 < 0) {
12999  __pyx_t_30 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
13000  if (unlikely(__pyx_t_30 < 0)) __pyx_t_33 = 2;
13001  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_33 = 2;
13002  if (unlikely(__pyx_t_33 != -1)) {
13003  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13004  __PYX_ERR(0, 569, __pyx_L1_error)
13005  }
13006  __pyx_t_29 = __pyx_v_eN;
13007  __pyx_t_34 = __pyx_v_ebN;
13008  __pyx_t_35 = __pyx_v_i;
13009  __pyx_t_36 = __pyx_v_I;
13010  __pyx_t_33 = -1;
13011  if (__pyx_t_29 < 0) {
13012  __pyx_t_29 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
13013  if (unlikely(__pyx_t_29 < 0)) __pyx_t_33 = 0;
13014  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_33 = 0;
13015  if (__pyx_t_34 < 0) {
13016  __pyx_t_34 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
13017  if (unlikely(__pyx_t_34 < 0)) __pyx_t_33 = 1;
13018  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_33 = 1;
13019  if (__pyx_t_35 < 0) {
13020  __pyx_t_35 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
13021  if (unlikely(__pyx_t_35 < 0)) __pyx_t_33 = 2;
13022  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_33 = 2;
13023  if (__pyx_t_36 < 0) {
13024  __pyx_t_36 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
13025  if (unlikely(__pyx_t_36 < 0)) __pyx_t_33 = 3;
13026  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_33 = 3;
13027  if (unlikely(__pyx_t_33 != -1)) {
13028  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13029  __PYX_ERR(0, 569, __pyx_L1_error)
13030  }
13031  __pyx_t_37 = __pyx_v_eN;
13032  __pyx_t_38 = __pyx_v_i;
13033  __pyx_t_33 = -1;
13034  if (__pyx_t_37 < 0) {
13035  __pyx_t_37 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
13036  if (unlikely(__pyx_t_37 < 0)) __pyx_t_33 = 0;
13037  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_33 = 0;
13038  if (__pyx_t_38 < 0) {
13039  __pyx_t_38 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
13040  if (unlikely(__pyx_t_38 < 0)) __pyx_t_33 = 1;
13041  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_33 = 1;
13042  if (unlikely(__pyx_t_33 != -1)) {
13043  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13044  __PYX_ERR(0, 569, __pyx_L1_error)
13045  }
13046  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_36, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13047  }
13048  }
13049  }
13050  }
13051  }
13052 
13053  /* "subsurfaceTransportFunctions.pyx":486
13054  * #eN for upwind
13055  *
13056  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13057  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13058  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13059  */
13060 
13061  /* function exit code */
13062  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13063  goto __pyx_L0;
13064  __pyx_L1_error:;
13065  __Pyx_XDECREF(__pyx_t_1);
13066  __Pyx_XDECREF(__pyx_t_2);
13067  __Pyx_XDECREF(__pyx_t_4);
13068  __Pyx_XDECREF(__pyx_t_5);
13069  __Pyx_XDECREF(__pyx_t_9);
13070  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13071  __Pyx_PyThreadState_declare
13072  __Pyx_PyThreadState_assign
13073  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13074  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13075  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13076  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13077  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13078  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13079  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13080  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13081  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13082  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13083  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13084  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13085  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13086  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13087  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13088  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13089  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13090  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13091  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13092  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13093  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13094  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
13095  __pyx_r = NULL;
13096  goto __pyx_L2;
13097  __pyx_L0:;
13098  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13099  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13100  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13101  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13102  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13103  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13104  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13105  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13106  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13107  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13108  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13109  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13110  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13111  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13112  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13113  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13114  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13115  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13116  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13117  __pyx_L2:;
13118  __Pyx_XDECREF(__pyx_v_q);
13119  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
13120  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
13121  __Pyx_XGIVEREF(__pyx_r);
13122  __Pyx_RefNannyFinishContext();
13123  return __pyx_r;
13124 }
13125 
13126 /* "subsurfaceTransportFunctions.pyx":574
13127  * #i
13128  * #eN
13129  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13130  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13131  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13132  */
13133 
13134 /* Python wrapper */
13135 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13136 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
13137 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
13138 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13139  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
13140  PyArrayObject *__pyx_v_rowptr = 0;
13141  PyArrayObject *__pyx_v_colind = 0;
13142  int __pyx_v_nSpace;
13143  int __pyx_v_nElements_global;
13144  int __pyx_v_nElementBoundaries_element;
13145  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
13146  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
13147  int __pyx_v_nDOF_test_element;
13148  int __pyx_v_nDOF_trial_element;
13149  PyArrayObject *__pyx_v_q_u = 0;
13150  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
13151  PyArrayObject *__pyx_v_q_grad_w = 0;
13152  PyArrayObject *__pyx_v_q_grad_v = 0;
13153  PyArrayObject *__pyx_v_q_detJ = 0;
13154  PyArrayObject *__pyx_v_q_m = 0;
13155  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
13156  PyArrayObject *__pyx_v_q_mt = 0;
13157  PyArrayObject *__pyx_v_q_dmt = 0;
13158  PyArrayObject *__pyx_v_q_r = 0;
13159  PyArrayObject *__pyx_v_q_kr = 0;
13160  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
13161  PyArrayObject *__pyx_v_q_kr_up = 0;
13162  PyArrayObject *__pyx_v_q_flin = 0;
13163  PyArrayObject *__pyx_v_q_alin = 0;
13164  PyArrayObject *__pyx_v_elementJacobian = 0;
13165  int __pyx_lineno = 0;
13166  const char *__pyx_filename = NULL;
13167  int __pyx_clineno = 0;
13168  PyObject *__pyx_r = 0;
13169  __Pyx_RefNannyDeclarations
13170  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
13171  {
13172  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
13173  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
13174  if (unlikely(__pyx_kwds)) {
13175  Py_ssize_t kw_args;
13176  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13177  switch (pos_args) {
13178  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13179  CYTHON_FALLTHROUGH;
13180  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13181  CYTHON_FALLTHROUGH;
13182  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13183  CYTHON_FALLTHROUGH;
13184  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13185  CYTHON_FALLTHROUGH;
13186  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13187  CYTHON_FALLTHROUGH;
13188  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13189  CYTHON_FALLTHROUGH;
13190  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13191  CYTHON_FALLTHROUGH;
13192  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13193  CYTHON_FALLTHROUGH;
13194  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13195  CYTHON_FALLTHROUGH;
13196  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13197  CYTHON_FALLTHROUGH;
13198  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13199  CYTHON_FALLTHROUGH;
13200  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13201  CYTHON_FALLTHROUGH;
13202  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13203  CYTHON_FALLTHROUGH;
13204  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13205  CYTHON_FALLTHROUGH;
13206  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13207  CYTHON_FALLTHROUGH;
13208  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13209  CYTHON_FALLTHROUGH;
13210  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13211  CYTHON_FALLTHROUGH;
13212  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13213  CYTHON_FALLTHROUGH;
13214  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13215  CYTHON_FALLTHROUGH;
13216  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13217  CYTHON_FALLTHROUGH;
13218  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13219  CYTHON_FALLTHROUGH;
13220  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13221  CYTHON_FALLTHROUGH;
13222  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13223  CYTHON_FALLTHROUGH;
13224  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13225  CYTHON_FALLTHROUGH;
13226  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13227  CYTHON_FALLTHROUGH;
13228  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13229  CYTHON_FALLTHROUGH;
13230  case 0: break;
13231  default: goto __pyx_L5_argtuple_error;
13232  }
13233  kw_args = PyDict_Size(__pyx_kwds);
13234  switch (pos_args) {
13235  case 0:
13236  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
13237  else goto __pyx_L5_argtuple_error;
13238  CYTHON_FALLTHROUGH;
13239  case 1:
13240  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
13241  else {
13242  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); __PYX_ERR(0, 574, __pyx_L3_error)
13243  }
13244  CYTHON_FALLTHROUGH;
13245  case 2:
13246  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
13247  else {
13248  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); __PYX_ERR(0, 574, __pyx_L3_error)
13249  }
13250  CYTHON_FALLTHROUGH;
13251  case 3:
13252  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
13253  else {
13254  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); __PYX_ERR(0, 574, __pyx_L3_error)
13255  }
13256  CYTHON_FALLTHROUGH;
13257  case 4:
13258  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
13259  else {
13260  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); __PYX_ERR(0, 574, __pyx_L3_error)
13261  }
13262  CYTHON_FALLTHROUGH;
13263  case 5:
13264  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
13265  else {
13266  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); __PYX_ERR(0, 574, __pyx_L3_error)
13267  }
13268  CYTHON_FALLTHROUGH;
13269  case 6:
13270  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
13271  else {
13272  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); __PYX_ERR(0, 574, __pyx_L3_error)
13273  }
13274  CYTHON_FALLTHROUGH;
13275  case 7:
13276  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
13277  else {
13278  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); __PYX_ERR(0, 574, __pyx_L3_error)
13279  }
13280  CYTHON_FALLTHROUGH;
13281  case 8:
13282  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
13283  else {
13284  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); __PYX_ERR(0, 574, __pyx_L3_error)
13285  }
13286  CYTHON_FALLTHROUGH;
13287  case 9:
13288  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
13289  else {
13290  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); __PYX_ERR(0, 574, __pyx_L3_error)
13291  }
13292  CYTHON_FALLTHROUGH;
13293  case 10:
13294  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
13295  else {
13296  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); __PYX_ERR(0, 574, __pyx_L3_error)
13297  }
13298  CYTHON_FALLTHROUGH;
13299  case 11:
13300  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
13301  else {
13302  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); __PYX_ERR(0, 574, __pyx_L3_error)
13303  }
13304  CYTHON_FALLTHROUGH;
13305  case 12:
13306  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
13307  else {
13308  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); __PYX_ERR(0, 574, __pyx_L3_error)
13309  }
13310  CYTHON_FALLTHROUGH;
13311  case 13:
13312  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
13313  else {
13314  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); __PYX_ERR(0, 574, __pyx_L3_error)
13315  }
13316  CYTHON_FALLTHROUGH;
13317  case 14:
13318  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
13319  else {
13320  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); __PYX_ERR(0, 574, __pyx_L3_error)
13321  }
13322  CYTHON_FALLTHROUGH;
13323  case 15:
13324  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
13325  else {
13326  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); __PYX_ERR(0, 574, __pyx_L3_error)
13327  }
13328  CYTHON_FALLTHROUGH;
13329  case 16:
13330  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
13331  else {
13332  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); __PYX_ERR(0, 574, __pyx_L3_error)
13333  }
13334  CYTHON_FALLTHROUGH;
13335  case 17:
13336  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
13337  else {
13338  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); __PYX_ERR(0, 574, __pyx_L3_error)
13339  }
13340  CYTHON_FALLTHROUGH;
13341  case 18:
13342  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
13343  else {
13344  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); __PYX_ERR(0, 574, __pyx_L3_error)
13345  }
13346  CYTHON_FALLTHROUGH;
13347  case 19:
13348  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
13349  else {
13350  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); __PYX_ERR(0, 574, __pyx_L3_error)
13351  }
13352  CYTHON_FALLTHROUGH;
13353  case 20:
13354  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
13355  else {
13356  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); __PYX_ERR(0, 574, __pyx_L3_error)
13357  }
13358  CYTHON_FALLTHROUGH;
13359  case 21:
13360  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
13361  else {
13362  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); __PYX_ERR(0, 574, __pyx_L3_error)
13363  }
13364  CYTHON_FALLTHROUGH;
13365  case 22:
13366  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
13367  else {
13368  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); __PYX_ERR(0, 574, __pyx_L3_error)
13369  }
13370  CYTHON_FALLTHROUGH;
13371  case 23:
13372  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
13373  else {
13374  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); __PYX_ERR(0, 574, __pyx_L3_error)
13375  }
13376  CYTHON_FALLTHROUGH;
13377  case 24:
13378  if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
13379  else {
13380  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); __PYX_ERR(0, 574, __pyx_L3_error)
13381  }
13382  CYTHON_FALLTHROUGH;
13383  case 25:
13384  if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
13385  else {
13386  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); __PYX_ERR(0, 574, __pyx_L3_error)
13387  }
13388  }
13389  if (unlikely(kw_args > 0)) {
13390  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
13391  }
13392  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
13393  goto __pyx_L5_argtuple_error;
13394  } else {
13395  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13396  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13397  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13398  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13399  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13400  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13401  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13402  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13403  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13404  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13405  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13406  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13407  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13408  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13409  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13410  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13411  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13412  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13413  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13414  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13415  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13416  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13417  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13418  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13419  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13420  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13421  }
13422  __pyx_v_gravity = ((PyArrayObject *)values[0]);
13423  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
13424  __pyx_v_colind = ((PyArrayObject *)values[2]);
13425  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L3_error)
13426  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L3_error)
13427  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error)
13428  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
13429  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
13430  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L3_error)
13431  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L3_error)
13432  __pyx_v_q_u = ((PyArrayObject *)values[10]);
13433  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
13434  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
13435  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
13436  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
13437  __pyx_v_q_m = ((PyArrayObject *)values[15]);
13438  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
13439  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
13440  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
13441  __pyx_v_q_r = ((PyArrayObject *)values[19]);
13442  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
13443  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
13444  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
13445  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
13446  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
13447  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
13448  }
13449  goto __pyx_L4_argument_unpacking_done;
13450  __pyx_L5_argtuple_error:;
13451  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 574, __pyx_L3_error)
13452  __pyx_L3_error:;
13453  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
13454  __Pyx_RefNannyFinishContext();
13455  return NULL;
13456  __pyx_L4_argument_unpacking_done:;
13457  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 574, __pyx_L1_error)
13458  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 575, __pyx_L1_error)
13459  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 576, __pyx_L1_error)
13460  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 581, __pyx_L1_error)
13461  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 582, __pyx_L1_error)
13462  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 586, __pyx_L1_error)
13463  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 587, __pyx_L1_error)
13464  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 588, __pyx_L1_error)
13465  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) __PYX_ERR(0, 589, __pyx_L1_error)
13466  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 591, __pyx_L1_error)
13467  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
13468  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) __PYX_ERR(0, 593, __pyx_L1_error)
13469  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
13470  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) __PYX_ERR(0, 595, __pyx_L1_error)
13471  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 596, __pyx_L1_error)
13472  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 597, __pyx_L1_error)
13473  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 598, __pyx_L1_error)
13474  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 599, __pyx_L1_error)
13475  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 602, __pyx_L1_error)
13476  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 603, __pyx_L1_error)
13477  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) __PYX_ERR(0, 605, __pyx_L1_error)
13478  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
13479 
13480  /* function exit code */
13481  goto __pyx_L0;
13482  __pyx_L1_error:;
13483  __pyx_r = NULL;
13484  __pyx_L0:;
13485  __Pyx_RefNannyFinishContext();
13486  return __pyx_r;
13487 }
13488 
13489 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian) {
13490  CYTHON_UNUSED int __pyx_v_upwindFlag;
13491  CYTHON_UNUSED int __pyx_v_picard;
13492  PyObject *__pyx_v_q = NULL;
13493  int __pyx_v_nnz;
13494  int __pyx_v_eN;
13495  int __pyx_v_ii;
13496  int __pyx_v_I;
13497  PyArrayObject *__pyx_v_a_up = 0;
13498  PyArrayObject *__pyx_v_f_up = 0;
13499  double __pyx_v_nAvgWeight;
13500  double __pyx_v_weight;
13501  double __pyx_v_volFactor;
13502  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
13503  double __pyx_v_volume;
13504  int __pyx_v_i;
13505  int __pyx_v_ebN;
13506  int __pyx_v_j;
13507  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
13508  __Pyx_Buffer __pyx_pybuffer_a_up;
13509  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
13510  __Pyx_Buffer __pyx_pybuffer_colind;
13511  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
13512  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
13513  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
13514  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
13515  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
13516  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
13517  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
13518  __Pyx_Buffer __pyx_pybuffer_f_up;
13519  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
13520  __Pyx_Buffer __pyx_pybuffer_gravity;
13521  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
13522  __Pyx_Buffer __pyx_pybuffer_q_alin;
13523  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
13524  __Pyx_Buffer __pyx_pybuffer_q_detJ;
13525  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
13526  __Pyx_Buffer __pyx_pybuffer_q_dkr;
13527  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
13528  __Pyx_Buffer __pyx_pybuffer_q_dm;
13529  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
13530  __Pyx_Buffer __pyx_pybuffer_q_dmt;
13531  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
13532  __Pyx_Buffer __pyx_pybuffer_q_flin;
13533  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
13534  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
13535  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
13536  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
13537  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
13538  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
13539  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
13540  __Pyx_Buffer __pyx_pybuffer_q_kr;
13541  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
13542  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
13543  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
13544  __Pyx_Buffer __pyx_pybuffer_q_m;
13545  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
13546  __Pyx_Buffer __pyx_pybuffer_q_mt;
13547  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
13548  __Pyx_Buffer __pyx_pybuffer_q_r;
13549  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
13550  __Pyx_Buffer __pyx_pybuffer_q_u;
13551  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
13552  __Pyx_Buffer __pyx_pybuffer_rowptr;
13553  PyObject *__pyx_r = NULL;
13554  __Pyx_RefNannyDeclarations
13555  PyObject *__pyx_t_1 = NULL;
13556  PyObject *__pyx_t_2 = NULL;
13557  Py_ssize_t __pyx_t_3;
13558  PyObject *__pyx_t_4 = NULL;
13559  PyObject *__pyx_t_5 = NULL;
13560  int __pyx_t_6;
13561  Py_ssize_t __pyx_t_7;
13562  int __pyx_t_8;
13563  PyObject *__pyx_t_9 = NULL;
13564  PyArrayObject *__pyx_t_10 = NULL;
13565  PyArrayObject *__pyx_t_11 = NULL;
13566  double __pyx_t_12;
13567  int __pyx_t_13;
13568  int __pyx_t_14;
13569  Py_ssize_t __pyx_t_15;
13570  int __pyx_t_16;
13571  int __pyx_t_17;
13572  int __pyx_t_18;
13573  int __pyx_t_19;
13574  Py_ssize_t __pyx_t_20;
13575  Py_ssize_t __pyx_t_21;
13576  Py_ssize_t __pyx_t_22;
13577  int __pyx_t_23;
13578  int __pyx_t_24;
13579  int __pyx_t_25;
13580  int __pyx_t_26;
13581  int __pyx_t_27;
13582  int __pyx_t_28;
13583  Py_ssize_t __pyx_t_29;
13584  int __pyx_t_30;
13585  int __pyx_t_31;
13586  int __pyx_t_32;
13587  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_33;
13588  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_34;
13589  int __pyx_t_35;
13590  Py_ssize_t __pyx_t_36;
13591  Py_ssize_t __pyx_t_37;
13592  Py_ssize_t __pyx_t_38;
13593  Py_ssize_t __pyx_t_39;
13594  Py_ssize_t __pyx_t_40;
13595  Py_ssize_t __pyx_t_41;
13596  Py_ssize_t __pyx_t_42;
13597  Py_ssize_t __pyx_t_43;
13598  int __pyx_lineno = 0;
13599  const char *__pyx_filename = NULL;
13600  int __pyx_clineno = 0;
13601  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
13602  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
13603  __pyx_pybuffer_a_up.refcount = 0;
13604  __pyx_pybuffernd_a_up.data = NULL;
13605  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
13606  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
13607  __pyx_pybuffer_f_up.refcount = 0;
13608  __pyx_pybuffernd_f_up.data = NULL;
13609  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
13610  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
13611  __pyx_pybuffer_gravity.refcount = 0;
13612  __pyx_pybuffernd_gravity.data = NULL;
13613  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
13614  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
13615  __pyx_pybuffer_rowptr.refcount = 0;
13616  __pyx_pybuffernd_rowptr.data = NULL;
13617  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
13618  __pyx_pybuffer_colind.pybuffer.buf = NULL;
13619  __pyx_pybuffer_colind.refcount = 0;
13620  __pyx_pybuffernd_colind.data = NULL;
13621  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
13622  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
13623  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
13624  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
13625  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
13626  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
13627  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
13628  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
13629  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
13630  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
13631  __pyx_pybuffer_q_u.refcount = 0;
13632  __pyx_pybuffernd_q_u.data = NULL;
13633  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
13634  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
13635  __pyx_pybuffer_q_grad_u.refcount = 0;
13636  __pyx_pybuffernd_q_grad_u.data = NULL;
13637  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
13638  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
13639  __pyx_pybuffer_q_grad_w.refcount = 0;
13640  __pyx_pybuffernd_q_grad_w.data = NULL;
13641  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
13642  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
13643  __pyx_pybuffer_q_grad_v.refcount = 0;
13644  __pyx_pybuffernd_q_grad_v.data = NULL;
13645  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
13646  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
13647  __pyx_pybuffer_q_detJ.refcount = 0;
13648  __pyx_pybuffernd_q_detJ.data = NULL;
13649  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
13650  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
13651  __pyx_pybuffer_q_m.refcount = 0;
13652  __pyx_pybuffernd_q_m.data = NULL;
13653  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
13654  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
13655  __pyx_pybuffer_q_dm.refcount = 0;
13656  __pyx_pybuffernd_q_dm.data = NULL;
13657  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
13658  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
13659  __pyx_pybuffer_q_mt.refcount = 0;
13660  __pyx_pybuffernd_q_mt.data = NULL;
13661  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
13662  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
13663  __pyx_pybuffer_q_dmt.refcount = 0;
13664  __pyx_pybuffernd_q_dmt.data = NULL;
13665  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
13666  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
13667  __pyx_pybuffer_q_r.refcount = 0;
13668  __pyx_pybuffernd_q_r.data = NULL;
13669  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
13670  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
13671  __pyx_pybuffer_q_kr.refcount = 0;
13672  __pyx_pybuffernd_q_kr.data = NULL;
13673  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
13674  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
13675  __pyx_pybuffer_q_dkr.refcount = 0;
13676  __pyx_pybuffernd_q_dkr.data = NULL;
13677  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
13678  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
13679  __pyx_pybuffer_q_kr_up.refcount = 0;
13680  __pyx_pybuffernd_q_kr_up.data = NULL;
13681  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
13682  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
13683  __pyx_pybuffer_q_flin.refcount = 0;
13684  __pyx_pybuffernd_q_flin.data = NULL;
13685  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
13686  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
13687  __pyx_pybuffer_q_alin.refcount = 0;
13688  __pyx_pybuffernd_q_alin.data = NULL;
13689  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
13690  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
13691  __pyx_pybuffer_elementJacobian.refcount = 0;
13692  __pyx_pybuffernd_elementJacobian.data = NULL;
13693  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
13694  {
13695  __Pyx_BufFmt_StackElem __pyx_stack[1];
13696  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13697  }
13698  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
13699  {
13700  __Pyx_BufFmt_StackElem __pyx_stack[1];
13701  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13702  }
13703  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
13704  {
13705  __Pyx_BufFmt_StackElem __pyx_stack[1];
13706  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13707  }
13708  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
13709  {
13710  __Pyx_BufFmt_StackElem __pyx_stack[1];
13711  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13712  }
13713  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
13714  {
13715  __Pyx_BufFmt_StackElem __pyx_stack[1];
13716  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13717  }
13718  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
13719  {
13720  __Pyx_BufFmt_StackElem __pyx_stack[1];
13721  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13722  }
13723  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
13724  {
13725  __Pyx_BufFmt_StackElem __pyx_stack[1];
13726  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13727  }
13728  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
13729  {
13730  __Pyx_BufFmt_StackElem __pyx_stack[1];
13731  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13732  }
13733  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
13734  {
13735  __Pyx_BufFmt_StackElem __pyx_stack[1];
13736  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13737  }
13738  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
13739  {
13740  __Pyx_BufFmt_StackElem __pyx_stack[1];
13741  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13742  }
13743  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
13744  {
13745  __Pyx_BufFmt_StackElem __pyx_stack[1];
13746  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13747  }
13748  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
13749  {
13750  __Pyx_BufFmt_StackElem __pyx_stack[1];
13751  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13752  }
13753  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
13754  {
13755  __Pyx_BufFmt_StackElem __pyx_stack[1];
13756  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13757  }
13758  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
13759  {
13760  __Pyx_BufFmt_StackElem __pyx_stack[1];
13761  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13762  }
13763  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
13764  {
13765  __Pyx_BufFmt_StackElem __pyx_stack[1];
13766  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13767  }
13768  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
13769  {
13770  __Pyx_BufFmt_StackElem __pyx_stack[1];
13771  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13772  }
13773  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
13774  {
13775  __Pyx_BufFmt_StackElem __pyx_stack[1];
13776  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13777  }
13778  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
13779  {
13780  __Pyx_BufFmt_StackElem __pyx_stack[1];
13781  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13782  }
13783  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
13784  {
13785  __Pyx_BufFmt_StackElem __pyx_stack[1];
13786  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13787  }
13788  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
13789  {
13790  __Pyx_BufFmt_StackElem __pyx_stack[1];
13791  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13792  }
13793  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
13794  {
13795  __Pyx_BufFmt_StackElem __pyx_stack[1];
13796  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13797  }
13798  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
13799 
13800  /* "subsurfaceTransportFunctions.pyx":620
13801  *
13802  * """
13803  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
13804  * cdef int picard = 1
13805  * #check some sizes
13806  */
13807  __pyx_v_upwindFlag = 1;
13808 
13809  /* "subsurfaceTransportFunctions.pyx":621
13810  * """
13811  * cdef int upwindFlag = 1
13812  * cdef int picard = 1 # <<<<<<<<<<<<<<
13813  * #check some sizes
13814  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13815  */
13816  __pyx_v_picard = 1;
13817 
13818  /* "subsurfaceTransportFunctions.pyx":623
13819  * cdef int picard = 1
13820  * #check some sizes
13821  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13822  * assert q.shape[1] == nSpace+1
13823  * assert nDOF_test_element == nSpace+1
13824  */
13825  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13826  __Pyx_GOTREF(__pyx_t_1);
13827  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
13828  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
13829  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
13830  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
13831  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
13832  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
13833  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
13834  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
13835  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
13836  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
13837  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
13838  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
13839  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
13840  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
13841  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
13842  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13843  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13844  for (;;) {
13845  if (__pyx_t_3 >= 5) break;
13846  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13847  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13848  #else
13849  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13850  __Pyx_GOTREF(__pyx_t_1);
13851  #endif
13852  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
13853  __pyx_t_1 = 0;
13854 
13855  /* "subsurfaceTransportFunctions.pyx":624
13856  * #check some sizes
13857  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13858  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
13859  * assert nDOF_test_element == nSpace+1
13860  * cdef int nnz = rowptr[nSpace]
13861  */
13862  #ifndef CYTHON_WITHOUT_ASSERTIONS
13863  if (unlikely(!Py_OptimizeFlag)) {
13864  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13865  __Pyx_GOTREF(__pyx_t_1);
13866  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
13867  __Pyx_GOTREF(__pyx_t_4);
13868  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13869  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13870  __Pyx_GOTREF(__pyx_t_1);
13871  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
13872  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13873  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13874  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 624, __pyx_L1_error)
13875  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13876  if (unlikely(!__pyx_t_6)) {
13877  PyErr_SetNone(PyExc_AssertionError);
13878  __PYX_ERR(0, 624, __pyx_L1_error)
13879  }
13880  }
13881  #endif
13882 
13883  /* "subsurfaceTransportFunctions.pyx":623
13884  * cdef int picard = 1
13885  * #check some sizes
13886  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13887  * assert q.shape[1] == nSpace+1
13888  * assert nDOF_test_element == nSpace+1
13889  */
13890  }
13891  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13892 
13893  /* "subsurfaceTransportFunctions.pyx":625
13894  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13895  * assert q.shape[1] == nSpace+1
13896  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
13897  * cdef int nnz = rowptr[nSpace]
13898  * #temporaries
13899  */
13900  #ifndef CYTHON_WITHOUT_ASSERTIONS
13901  if (unlikely(!Py_OptimizeFlag)) {
13902  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
13903  PyErr_SetNone(PyExc_AssertionError);
13904  __PYX_ERR(0, 625, __pyx_L1_error)
13905  }
13906  }
13907  #endif
13908 
13909  /* "subsurfaceTransportFunctions.pyx":626
13910  * assert q.shape[1] == nSpace+1
13911  * assert nDOF_test_element == nSpace+1
13912  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
13913  * #temporaries
13914  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13915  */
13916  __pyx_t_7 = __pyx_v_nSpace;
13917  __pyx_t_8 = -1;
13918  if (__pyx_t_7 < 0) {
13919  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13920  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
13921  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
13922  if (unlikely(__pyx_t_8 != -1)) {
13923  __Pyx_RaiseBufferIndexError(__pyx_t_8);
13924  __PYX_ERR(0, 626, __pyx_L1_error)
13925  }
13926  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13927 
13928  /* "subsurfaceTransportFunctions.pyx":630
13929  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13930  * cdef int eN,eN_neighbor,ii,I
13931  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
13932  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
13933  * #for averaging/integration weights
13934  */
13935  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13936  __Pyx_GOTREF(__pyx_t_5);
13937  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
13938  __Pyx_GOTREF(__pyx_t_1);
13939  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13940  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13941  __Pyx_GOTREF(__pyx_t_5);
13942  __pyx_t_4 = NULL;
13943  __pyx_t_8 = 0;
13944  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
13945  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
13946  if (likely(__pyx_t_4)) {
13947  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
13948  __Pyx_INCREF(__pyx_t_4);
13949  __Pyx_INCREF(function);
13950  __Pyx_DECREF_SET(__pyx_t_1, function);
13951  __pyx_t_8 = 1;
13952  }
13953  }
13954  #if CYTHON_FAST_PYCALL
13955  if (PyFunction_Check(__pyx_t_1)) {
13956  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
13957  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13958  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13959  __Pyx_GOTREF(__pyx_t_2);
13960  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13961  } else
13962  #endif
13963  #if CYTHON_FAST_PYCCALL
13964  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
13965  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
13966  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13967  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13968  __Pyx_GOTREF(__pyx_t_2);
13969  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13970  } else
13971  #endif
13972  {
13973  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error)
13974  __Pyx_GOTREF(__pyx_t_9);
13975  if (__pyx_t_4) {
13976  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
13977  }
13978  __Pyx_GIVEREF(__pyx_t_5);
13979  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
13980  __Pyx_INCREF(__pyx_n_s_d);
13981  __Pyx_GIVEREF(__pyx_n_s_d);
13982  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
13983  __pyx_t_5 = 0;
13984  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13985  __Pyx_GOTREF(__pyx_t_2);
13986  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13987  }
13988  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13989  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 630, __pyx_L1_error)
13990  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
13991  {
13992  __Pyx_BufFmt_StackElem __pyx_stack[1];
13993  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
13994  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
13995  __PYX_ERR(0, 630, __pyx_L1_error)
13996  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
13997  }
13998  }
13999  __pyx_t_10 = 0;
14000  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
14001  __pyx_t_2 = 0;
14002 
14003  /* "subsurfaceTransportFunctions.pyx":631
14004  * cdef int eN,eN_neighbor,ii,I
14005  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
14006  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
14007  * #for averaging/integration weights
14008  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14009  */
14010  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14011  __Pyx_GOTREF(__pyx_t_1);
14012  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
14013  __Pyx_GOTREF(__pyx_t_9);
14014  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14015  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14016  __Pyx_GOTREF(__pyx_t_1);
14017  __pyx_t_5 = NULL;
14018  __pyx_t_8 = 0;
14019  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14020  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
14021  if (likely(__pyx_t_5)) {
14022  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14023  __Pyx_INCREF(__pyx_t_5);
14024  __Pyx_INCREF(function);
14025  __Pyx_DECREF_SET(__pyx_t_9, function);
14026  __pyx_t_8 = 1;
14027  }
14028  }
14029  #if CYTHON_FAST_PYCALL
14030  if (PyFunction_Check(__pyx_t_9)) {
14031  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14032  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14033  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14034  __Pyx_GOTREF(__pyx_t_2);
14035  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14036  } else
14037  #endif
14038  #if CYTHON_FAST_PYCCALL
14039  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14040  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14041  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14042  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14043  __Pyx_GOTREF(__pyx_t_2);
14044  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14045  } else
14046  #endif
14047  {
14048  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
14049  __Pyx_GOTREF(__pyx_t_4);
14050  if (__pyx_t_5) {
14051  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
14052  }
14053  __Pyx_GIVEREF(__pyx_t_1);
14054  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
14055  __Pyx_INCREF(__pyx_n_s_d);
14056  __Pyx_GIVEREF(__pyx_n_s_d);
14057  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
14058  __pyx_t_1 = 0;
14059  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14060  __Pyx_GOTREF(__pyx_t_2);
14061  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14062  }
14063  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14064  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 631, __pyx_L1_error)
14065  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
14066  {
14067  __Pyx_BufFmt_StackElem __pyx_stack[1];
14068  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14069  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
14070  __PYX_ERR(0, 631, __pyx_L1_error)
14071  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
14072  }
14073  }
14074  __pyx_t_11 = 0;
14075  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
14076  __pyx_t_2 = 0;
14077 
14078  /* "subsurfaceTransportFunctions.pyx":633
14079  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14080  * #for averaging/integration weights
14081  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
14082  * cdef double weight=1.0,volFactor = 1.0
14083  * cdef int thisElementIsUpwind = 1
14084  */
14085  __pyx_t_12 = (__pyx_v_nSpace + 1.);
14086  if (unlikely(__pyx_t_12 == 0)) {
14087  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14088  __PYX_ERR(0, 633, __pyx_L1_error)
14089  }
14090  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
14091 
14092  /* "subsurfaceTransportFunctions.pyx":634
14093  * #for averaging/integration weights
14094  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14095  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
14096  * cdef int thisElementIsUpwind = 1
14097  * if nSpace == 2:
14098  */
14099  __pyx_v_weight = 1.0;
14100  __pyx_v_volFactor = 1.0;
14101 
14102  /* "subsurfaceTransportFunctions.pyx":635
14103  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14104  * cdef double weight=1.0,volFactor = 1.0
14105  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
14106  * if nSpace == 2:
14107  * volFactor = 0.5
14108  */
14109  __pyx_v_thisElementIsUpwind = 1;
14110 
14111  /* "subsurfaceTransportFunctions.pyx":636
14112  * cdef double weight=1.0,volFactor = 1.0
14113  * cdef int thisElementIsUpwind = 1
14114  * if nSpace == 2: # <<<<<<<<<<<<<<
14115  * volFactor = 0.5
14116  * if nSpace == 3:
14117  */
14118  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
14119  if (__pyx_t_6) {
14120 
14121  /* "subsurfaceTransportFunctions.pyx":637
14122  * cdef int thisElementIsUpwind = 1
14123  * if nSpace == 2:
14124  * volFactor = 0.5 # <<<<<<<<<<<<<<
14125  * if nSpace == 3:
14126  * volFactor = 1.0/6.0
14127  */
14128  __pyx_v_volFactor = 0.5;
14129 
14130  /* "subsurfaceTransportFunctions.pyx":636
14131  * cdef double weight=1.0,volFactor = 1.0
14132  * cdef int thisElementIsUpwind = 1
14133  * if nSpace == 2: # <<<<<<<<<<<<<<
14134  * volFactor = 0.5
14135  * if nSpace == 3:
14136  */
14137  }
14138 
14139  /* "subsurfaceTransportFunctions.pyx":638
14140  * if nSpace == 2:
14141  * volFactor = 0.5
14142  * if nSpace == 3: # <<<<<<<<<<<<<<
14143  * volFactor = 1.0/6.0
14144  * #
14145  */
14146  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
14147  if (__pyx_t_6) {
14148 
14149  /* "subsurfaceTransportFunctions.pyx":639
14150  * volFactor = 0.5
14151  * if nSpace == 3:
14152  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
14153  * #
14154  * for eN in range(nElements_global):
14155  */
14156  __pyx_v_volFactor = (1.0 / 6.0);
14157 
14158  /* "subsurfaceTransportFunctions.pyx":638
14159  * if nSpace == 2:
14160  * volFactor = 0.5
14161  * if nSpace == 3: # <<<<<<<<<<<<<<
14162  * volFactor = 1.0/6.0
14163  * #
14164  */
14165  }
14166 
14167  /* "subsurfaceTransportFunctions.pyx":641
14168  * volFactor = 1.0/6.0
14169  * #
14170  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
14171  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14172  * weight = nAvgWeight*volume
14173  */
14174  __pyx_t_8 = __pyx_v_nElements_global;
14175  __pyx_t_13 = __pyx_t_8;
14176  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
14177  __pyx_v_eN = __pyx_t_14;
14178 
14179  /* "subsurfaceTransportFunctions.pyx":642
14180  * #
14181  * for eN in range(nElements_global):
14182  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
14183  * weight = nAvgWeight*volume
14184  *
14185  */
14186  __pyx_t_7 = __pyx_v_eN;
14187  __pyx_t_15 = 0;
14188  __pyx_t_16 = -1;
14189  if (__pyx_t_7 < 0) {
14190  __pyx_t_7 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
14191  if (unlikely(__pyx_t_7 < 0)) __pyx_t_16 = 0;
14192  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
14193  if (__pyx_t_15 < 0) {
14194  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
14195  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
14196  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
14197  if (unlikely(__pyx_t_16 != -1)) {
14198  __Pyx_RaiseBufferIndexError(__pyx_t_16);
14199  __PYX_ERR(0, 642, __pyx_L1_error)
14200  }
14201  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
14202 
14203  /* "subsurfaceTransportFunctions.pyx":643
14204  * for eN in range(nElements_global):
14205  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14206  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
14207  *
14208  *
14209  */
14210  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
14211 
14212  /* "subsurfaceTransportFunctions.pyx":646
14213  *
14214  *
14215  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
14216  * #nodal quadrature so diagonal
14217  * ##mass
14218  */
14219  __pyx_t_16 = __pyx_v_nDOF_test_element;
14220  __pyx_t_17 = __pyx_t_16;
14221  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
14222  __pyx_v_i = __pyx_t_18;
14223 
14224  /* "subsurfaceTransportFunctions.pyx":650
14225  * ##mass
14226  * #elementResidual[eN,i] += weight*q_m[eN,i]
14227  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
14228  *
14229  * #have to actually compute loop over other nodes for stiffness terms
14230  */
14231  __pyx_t_15 = __pyx_v_eN;
14232  __pyx_t_7 = __pyx_v_i;
14233  __pyx_t_19 = -1;
14234  if (__pyx_t_15 < 0) {
14235  __pyx_t_15 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
14236  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 0;
14237  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_19 = 0;
14238  if (__pyx_t_7 < 0) {
14239  __pyx_t_7 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
14240  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 1;
14241  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_19 = 1;
14242  if (unlikely(__pyx_t_19 != -1)) {
14243  __Pyx_RaiseBufferIndexError(__pyx_t_19);
14244  __PYX_ERR(0, 650, __pyx_L1_error)
14245  }
14246  __pyx_t_20 = __pyx_v_eN;
14247  __pyx_t_21 = __pyx_v_i;
14248  __pyx_t_22 = __pyx_v_i;
14249  __pyx_t_19 = -1;
14250  if (__pyx_t_20 < 0) {
14251  __pyx_t_20 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14252  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
14253  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_19 = 0;
14254  if (__pyx_t_21 < 0) {
14255  __pyx_t_21 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14256  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 1;
14257  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_19 = 1;
14258  if (__pyx_t_22 < 0) {
14259  __pyx_t_22 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14260  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 2;
14261  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_19 = 2;
14262  if (unlikely(__pyx_t_19 != -1)) {
14263  __Pyx_RaiseBufferIndexError(__pyx_t_19);
14264  __PYX_ERR(0, 650, __pyx_L1_error)
14265  }
14266  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
14267 
14268  /* "subsurfaceTransportFunctions.pyx":653
14269  *
14270  * #have to actually compute loop over other nodes for stiffness terms
14271  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
14272  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14273  * for ii in range(nnz):
14274  */
14275  __pyx_t_19 = __pyx_v_nElementBoundaries_element;
14276  __pyx_t_23 = __pyx_t_19;
14277  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
14278  __pyx_v_ebN = __pyx_t_24;
14279 
14280  /* "subsurfaceTransportFunctions.pyx":655
14281  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
14282  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14283  * for ii in range(nnz): # <<<<<<<<<<<<<<
14284  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14285  * for I in range(nSpace):
14286  */
14287  __pyx_t_25 = __pyx_v_nnz;
14288  __pyx_t_26 = __pyx_t_25;
14289  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14290  __pyx_v_ii = __pyx_t_27;
14291 
14292  /* "subsurfaceTransportFunctions.pyx":656
14293  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14294  * for ii in range(nnz):
14295  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14296  * for I in range(nSpace):
14297  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14298  */
14299  __pyx_t_7 = __pyx_v_eN;
14300  __pyx_t_15 = __pyx_v_ebN;
14301  __pyx_t_22 = __pyx_v_ii;
14302  __pyx_t_28 = -1;
14303  if (__pyx_t_7 < 0) {
14304  __pyx_t_7 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
14305  if (unlikely(__pyx_t_7 < 0)) __pyx_t_28 = 0;
14306  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_28 = 0;
14307  if (__pyx_t_15 < 0) {
14308  __pyx_t_15 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
14309  if (unlikely(__pyx_t_15 < 0)) __pyx_t_28 = 1;
14310  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_28 = 1;
14311  if (__pyx_t_22 < 0) {
14312  __pyx_t_22 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
14313  if (unlikely(__pyx_t_22 < 0)) __pyx_t_28 = 2;
14314  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_28 = 2;
14315  if (unlikely(__pyx_t_28 != -1)) {
14316  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14317  __PYX_ERR(0, 656, __pyx_L1_error)
14318  }
14319  __pyx_t_21 = __pyx_v_eN;
14320  __pyx_t_20 = __pyx_v_ebN;
14321  __pyx_t_28 = -1;
14322  if (__pyx_t_21 < 0) {
14323  __pyx_t_21 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14324  if (unlikely(__pyx_t_21 < 0)) __pyx_t_28 = 0;
14325  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_28 = 0;
14326  if (__pyx_t_20 < 0) {
14327  __pyx_t_20 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14328  if (unlikely(__pyx_t_20 < 0)) __pyx_t_28 = 1;
14329  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_28 = 1;
14330  if (unlikely(__pyx_t_28 != -1)) {
14331  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14332  __PYX_ERR(0, 656, __pyx_L1_error)
14333  }
14334  __pyx_t_29 = __pyx_v_ii;
14335  __pyx_t_28 = -1;
14336  if (__pyx_t_29 < 0) {
14337  __pyx_t_29 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14338  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
14339  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_28 = 0;
14340  if (unlikely(__pyx_t_28 != -1)) {
14341  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14342  __PYX_ERR(0, 656, __pyx_L1_error)
14343  }
14344  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14345  }
14346 
14347  /* "subsurfaceTransportFunctions.pyx":657
14348  * for ii in range(nnz):
14349  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14350  * for I in range(nSpace): # <<<<<<<<<<<<<<
14351  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14352  * #
14353  */
14354  __pyx_t_25 = __pyx_v_nSpace;
14355  __pyx_t_26 = __pyx_t_25;
14356  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14357  __pyx_v_I = __pyx_t_27;
14358 
14359  /* "subsurfaceTransportFunctions.pyx":658
14360  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14361  * for I in range(nSpace):
14362  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14363  * #
14364  *
14365  */
14366  __pyx_t_20 = __pyx_v_eN;
14367  __pyx_t_21 = __pyx_v_ebN;
14368  __pyx_t_22 = __pyx_v_I;
14369  __pyx_t_28 = -1;
14370  if (__pyx_t_20 < 0) {
14371  __pyx_t_20 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
14372  if (unlikely(__pyx_t_20 < 0)) __pyx_t_28 = 0;
14373  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_28 = 0;
14374  if (__pyx_t_21 < 0) {
14375  __pyx_t_21 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
14376  if (unlikely(__pyx_t_21 < 0)) __pyx_t_28 = 1;
14377  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_28 = 1;
14378  if (__pyx_t_22 < 0) {
14379  __pyx_t_22 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
14380  if (unlikely(__pyx_t_22 < 0)) __pyx_t_28 = 2;
14381  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_28 = 2;
14382  if (unlikely(__pyx_t_28 != -1)) {
14383  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14384  __PYX_ERR(0, 658, __pyx_L1_error)
14385  }
14386  __pyx_t_15 = __pyx_v_eN;
14387  __pyx_t_7 = __pyx_v_ebN;
14388  __pyx_t_28 = -1;
14389  if (__pyx_t_15 < 0) {
14390  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14391  if (unlikely(__pyx_t_15 < 0)) __pyx_t_28 = 0;
14392  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_28 = 0;
14393  if (__pyx_t_7 < 0) {
14394  __pyx_t_7 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14395  if (unlikely(__pyx_t_7 < 0)) __pyx_t_28 = 1;
14396  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_28 = 1;
14397  if (unlikely(__pyx_t_28 != -1)) {
14398  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14399  __PYX_ERR(0, 658, __pyx_L1_error)
14400  }
14401  __pyx_t_29 = __pyx_v_I;
14402  __pyx_t_28 = -1;
14403  if (__pyx_t_29 < 0) {
14404  __pyx_t_29 += __pyx_pybuffernd_f_up.diminfo[0].shape;
14405  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
14406  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_28 = 0;
14407  if (unlikely(__pyx_t_28 != -1)) {
14408  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14409  __PYX_ERR(0, 658, __pyx_L1_error)
14410  }
14411  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14412  }
14413 
14414  /* "subsurfaceTransportFunctions.pyx":662
14415  *
14416  * #Picard part first
14417  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
14418  * for I in range(nSpace):
14419  * for ii in range(rowptr[I],rowptr[I+1]):
14420  */
14421  __pyx_t_25 = __pyx_v_nDOF_trial_element;
14422  __pyx_t_26 = __pyx_t_25;
14423  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14424  __pyx_v_j = __pyx_t_27;
14425 
14426  /* "subsurfaceTransportFunctions.pyx":663
14427  * #Picard part first
14428  * for j in range(nDOF_trial_element):
14429  * for I in range(nSpace): # <<<<<<<<<<<<<<
14430  * for ii in range(rowptr[I],rowptr[I+1]):
14431  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14432  */
14433  __pyx_t_28 = __pyx_v_nSpace;
14434  __pyx_t_30 = __pyx_t_28;
14435  for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
14436  __pyx_v_I = __pyx_t_31;
14437 
14438  /* "subsurfaceTransportFunctions.pyx":664
14439  * for j in range(nDOF_trial_element):
14440  * for I in range(nSpace):
14441  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
14442  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14443  * #j picard
14444  */
14445  __pyx_t_7 = (__pyx_v_I + 1);
14446  __pyx_t_32 = -1;
14447  if (__pyx_t_7 < 0) {
14448  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14449  if (unlikely(__pyx_t_7 < 0)) __pyx_t_32 = 0;
14450  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_32 = 0;
14451  if (unlikely(__pyx_t_32 != -1)) {
14452  __Pyx_RaiseBufferIndexError(__pyx_t_32);
14453  __PYX_ERR(0, 664, __pyx_L1_error)
14454  }
14455  __pyx_t_33 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14456  __pyx_t_7 = __pyx_v_I;
14457  __pyx_t_32 = -1;
14458  if (__pyx_t_7 < 0) {
14459  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14460  if (unlikely(__pyx_t_7 < 0)) __pyx_t_32 = 0;
14461  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_32 = 0;
14462  if (unlikely(__pyx_t_32 != -1)) {
14463  __Pyx_RaiseBufferIndexError(__pyx_t_32);
14464  __PYX_ERR(0, 664, __pyx_L1_error)
14465  }
14466  __pyx_t_34 = __pyx_t_33;
14467  for (__pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_32 < __pyx_t_34; __pyx_t_32+=1) {
14468  __pyx_v_ii = __pyx_t_32;
14469 
14470  /* "subsurfaceTransportFunctions.pyx":665
14471  * for I in range(nSpace):
14472  * for ii in range(rowptr[I],rowptr[I+1]):
14473  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
14474  * #j picard
14475  * #i
14476  */
14477  __pyx_t_15 = __pyx_v_ii;
14478  __pyx_t_35 = -1;
14479  if (__pyx_t_15 < 0) {
14480  __pyx_t_15 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14481  if (unlikely(__pyx_t_15 < 0)) __pyx_t_35 = 0;
14482  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_35 = 0;
14483  if (unlikely(__pyx_t_35 != -1)) {
14484  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14485  __PYX_ERR(0, 665, __pyx_L1_error)
14486  }
14487  __pyx_t_22 = __pyx_v_ii;
14488  __pyx_t_35 = -1;
14489  if (__pyx_t_22 < 0) {
14490  __pyx_t_22 += __pyx_pybuffernd_colind.diminfo[0].shape;
14491  if (unlikely(__pyx_t_22 < 0)) __pyx_t_35 = 0;
14492  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_35 = 0;
14493  if (unlikely(__pyx_t_35 != -1)) {
14494  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14495  __PYX_ERR(0, 665, __pyx_L1_error)
14496  }
14497  __pyx_t_21 = __pyx_v_eN;
14498  __pyx_t_20 = __pyx_v_ebN;
14499  __pyx_t_29 = __pyx_v_j;
14500  __pyx_t_36 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_colind.diminfo[0].strides));
14501  __pyx_t_35 = -1;
14502  if (__pyx_t_21 < 0) {
14503  __pyx_t_21 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
14504  if (unlikely(__pyx_t_21 < 0)) __pyx_t_35 = 0;
14505  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_35 = 0;
14506  if (__pyx_t_20 < 0) {
14507  __pyx_t_20 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
14508  if (unlikely(__pyx_t_20 < 0)) __pyx_t_35 = 1;
14509  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_35 = 1;
14510  if (__pyx_t_29 < 0) {
14511  __pyx_t_29 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
14512  if (unlikely(__pyx_t_29 < 0)) __pyx_t_35 = 2;
14513  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_35 = 2;
14514  if (__pyx_t_36 < 0) {
14515  __pyx_t_36 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
14516  if (unlikely(__pyx_t_36 < 0)) __pyx_t_35 = 3;
14517  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_35 = 3;
14518  if (unlikely(__pyx_t_35 != -1)) {
14519  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14520  __PYX_ERR(0, 665, __pyx_L1_error)
14521  }
14522  __pyx_t_37 = __pyx_v_eN;
14523  __pyx_t_38 = __pyx_v_ebN;
14524  __pyx_t_39 = __pyx_v_i;
14525  __pyx_t_40 = __pyx_v_I;
14526  __pyx_t_35 = -1;
14527  if (__pyx_t_37 < 0) {
14528  __pyx_t_37 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
14529  if (unlikely(__pyx_t_37 < 0)) __pyx_t_35 = 0;
14530  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_35 = 0;
14531  if (__pyx_t_38 < 0) {
14532  __pyx_t_38 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
14533  if (unlikely(__pyx_t_38 < 0)) __pyx_t_35 = 1;
14534  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_35 = 1;
14535  if (__pyx_t_39 < 0) {
14536  __pyx_t_39 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
14537  if (unlikely(__pyx_t_39 < 0)) __pyx_t_35 = 2;
14538  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_35 = 2;
14539  if (__pyx_t_40 < 0) {
14540  __pyx_t_40 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
14541  if (unlikely(__pyx_t_40 < 0)) __pyx_t_35 = 3;
14542  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_35 = 3;
14543  if (unlikely(__pyx_t_35 != -1)) {
14544  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14545  __PYX_ERR(0, 665, __pyx_L1_error)
14546  }
14547  __pyx_t_41 = __pyx_v_eN;
14548  __pyx_t_42 = __pyx_v_i;
14549  __pyx_t_43 = __pyx_v_j;
14550  __pyx_t_35 = -1;
14551  if (__pyx_t_41 < 0) {
14552  __pyx_t_41 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14553  if (unlikely(__pyx_t_41 < 0)) __pyx_t_35 = 0;
14554  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_35 = 0;
14555  if (__pyx_t_42 < 0) {
14556  __pyx_t_42 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14557  if (unlikely(__pyx_t_42 < 0)) __pyx_t_35 = 1;
14558  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_35 = 1;
14559  if (__pyx_t_43 < 0) {
14560  __pyx_t_43 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14561  if (unlikely(__pyx_t_43 < 0)) __pyx_t_35 = 2;
14562  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_35 = 2;
14563  if (unlikely(__pyx_t_35 != -1)) {
14564  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14565  __PYX_ERR(0, 665, __pyx_L1_error)
14566  }
14567  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_36, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_40, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
14568  }
14569  }
14570  }
14571  }
14572  }
14573  }
14574 
14575  /* "subsurfaceTransportFunctions.pyx":574
14576  * #i
14577  * #eN
14578  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
14579  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
14580  * numpy.ndarray[ITYPE_t,ndim=1] colind,
14581  */
14582 
14583  /* function exit code */
14584  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14585  goto __pyx_L0;
14586  __pyx_L1_error:;
14587  __Pyx_XDECREF(__pyx_t_1);
14588  __Pyx_XDECREF(__pyx_t_2);
14589  __Pyx_XDECREF(__pyx_t_4);
14590  __Pyx_XDECREF(__pyx_t_5);
14591  __Pyx_XDECREF(__pyx_t_9);
14592  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14593  __Pyx_PyThreadState_declare
14594  __Pyx_PyThreadState_assign
14595  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14596  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14597  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14598  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14599  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14600  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14601  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14602  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14603  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14604  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14605  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14606  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14607  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14608  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14609  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14610  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14611  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14612  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14613  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14614  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14615  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14616  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14617  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14618  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14619  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14620  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
14621  __pyx_r = NULL;
14622  goto __pyx_L2;
14623  __pyx_L0:;
14624  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14625  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14631  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14632  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14633  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14634  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14635  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14636  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14637  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14638  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14639  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14644  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14645  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14646  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14647  __pyx_L2:;
14648  __Pyx_XDECREF(__pyx_v_q);
14649  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
14650  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
14651  __Pyx_XGIVEREF(__pyx_r);
14652  __Pyx_RefNannyFinishContext();
14653  return __pyx_r;
14654 }
14655 
14656 /* "subsurfaceTransportFunctions.pyx":673
14657  * ##################################################
14658  *
14659  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14660  * numpy.ndarray[DTYPE_t,ndim=3] w,
14661  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14662  */
14663 
14664 /* Python wrapper */
14665 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14666 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
14667 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
14668 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14669  PyArrayObject *__pyx_v_mt = 0;
14670  PyArrayObject *__pyx_v_w = 0;
14671  PyArrayObject *__pyx_v_dV = 0;
14672  PyArrayObject *__pyx_v_weak_residual = 0;
14673  int __pyx_lineno = 0;
14674  const char *__pyx_filename = NULL;
14675  int __pyx_clineno = 0;
14676  PyObject *__pyx_r = 0;
14677  __Pyx_RefNannyDeclarations
14678  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
14679  {
14680  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
14681  PyObject* values[4] = {0,0,0,0};
14682  if (unlikely(__pyx_kwds)) {
14683  Py_ssize_t kw_args;
14684  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14685  switch (pos_args) {
14686  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14687  CYTHON_FALLTHROUGH;
14688  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14689  CYTHON_FALLTHROUGH;
14690  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14691  CYTHON_FALLTHROUGH;
14692  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14693  CYTHON_FALLTHROUGH;
14694  case 0: break;
14695  default: goto __pyx_L5_argtuple_error;
14696  }
14697  kw_args = PyDict_Size(__pyx_kwds);
14698  switch (pos_args) {
14699  case 0:
14700  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
14701  else goto __pyx_L5_argtuple_error;
14702  CYTHON_FALLTHROUGH;
14703  case 1:
14704  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14705  else {
14706  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); __PYX_ERR(0, 673, __pyx_L3_error)
14707  }
14708  CYTHON_FALLTHROUGH;
14709  case 2:
14710  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14711  else {
14712  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); __PYX_ERR(0, 673, __pyx_L3_error)
14713  }
14714  CYTHON_FALLTHROUGH;
14715  case 3:
14716  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
14717  else {
14718  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); __PYX_ERR(0, 673, __pyx_L3_error)
14719  }
14720  }
14721  if (unlikely(kw_args > 0)) {
14722  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) __PYX_ERR(0, 673, __pyx_L3_error)
14723  }
14724  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14725  goto __pyx_L5_argtuple_error;
14726  } else {
14727  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14728  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14729  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14730  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14731  }
14732  __pyx_v_mt = ((PyArrayObject *)values[0]);
14733  __pyx_v_w = ((PyArrayObject *)values[1]);
14734  __pyx_v_dV = ((PyArrayObject *)values[2]);
14735  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
14736  }
14737  goto __pyx_L4_argument_unpacking_done;
14738  __pyx_L5_argtuple_error:;
14739  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 673, __pyx_L3_error)
14740  __pyx_L3_error:;
14741  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14742  __Pyx_RefNannyFinishContext();
14743  return NULL;
14744  __pyx_L4_argument_unpacking_done:;
14745  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 673, __pyx_L1_error)
14746  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 674, __pyx_L1_error)
14747  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 675, __pyx_L1_error)
14748  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) __PYX_ERR(0, 676, __pyx_L1_error)
14749  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
14750 
14751  /* function exit code */
14752  goto __pyx_L0;
14753  __pyx_L1_error:;
14754  __pyx_r = NULL;
14755  __pyx_L0:;
14756  __Pyx_RefNannyFinishContext();
14757  return __pyx_r;
14758 }
14759 
14760 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual) {
14761  int __pyx_v_eN;
14762  int __pyx_v_i;
14763  int __pyx_v_k;
14764  PyObject *__pyx_v_mt_avg = 0;
14765  PyObject *__pyx_v_vol = 0;
14766  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14767  __Pyx_Buffer __pyx_pybuffer_dV;
14768  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
14769  __Pyx_Buffer __pyx_pybuffer_mt;
14770  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14771  __Pyx_Buffer __pyx_pybuffer_w;
14772  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
14773  __Pyx_Buffer __pyx_pybuffer_weak_residual;
14774  PyObject *__pyx_r = NULL;
14775  __Pyx_RefNannyDeclarations
14776  npy_intp __pyx_t_1;
14777  npy_intp __pyx_t_2;
14778  int __pyx_t_3;
14779  npy_intp __pyx_t_4;
14780  npy_intp __pyx_t_5;
14781  int __pyx_t_6;
14782  Py_ssize_t __pyx_t_7;
14783  Py_ssize_t __pyx_t_8;
14784  int __pyx_t_9;
14785  Py_ssize_t __pyx_t_10;
14786  Py_ssize_t __pyx_t_11;
14787  PyObject *__pyx_t_12 = NULL;
14788  PyObject *__pyx_t_13 = NULL;
14789  PyObject *__pyx_t_14 = NULL;
14790  double __pyx_t_15;
14791  int __pyx_lineno = 0;
14792  const char *__pyx_filename = NULL;
14793  int __pyx_clineno = 0;
14794  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
14795  __pyx_pybuffer_mt.pybuffer.buf = NULL;
14796  __pyx_pybuffer_mt.refcount = 0;
14797  __pyx_pybuffernd_mt.data = NULL;
14798  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
14799  __pyx_pybuffer_w.pybuffer.buf = NULL;
14800  __pyx_pybuffer_w.refcount = 0;
14801  __pyx_pybuffernd_w.data = NULL;
14802  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14803  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14804  __pyx_pybuffer_dV.refcount = 0;
14805  __pyx_pybuffernd_dV.data = NULL;
14806  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14807  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
14808  __pyx_pybuffer_weak_residual.refcount = 0;
14809  __pyx_pybuffernd_weak_residual.data = NULL;
14810  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
14811  {
14812  __Pyx_BufFmt_StackElem __pyx_stack[1];
14813  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14814  }
14815  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
14816  {
14817  __Pyx_BufFmt_StackElem __pyx_stack[1];
14818  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14819  }
14820  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14821  {
14822  __Pyx_BufFmt_StackElem __pyx_stack[1];
14823  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14824  }
14825  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14826  {
14827  __Pyx_BufFmt_StackElem __pyx_stack[1];
14828  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14829  }
14830  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
14831 
14832  /* "subsurfaceTransportFunctions.pyx":682
14833  * cdef int eN,i,k
14834  * cdef mt_avg,vol
14835  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
14836  * mt_avg = 0.0
14837  * vol = 0.0
14838  */
14839  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
14840  __pyx_t_2 = __pyx_t_1;
14841  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14842  __pyx_v_eN = __pyx_t_3;
14843 
14844  /* "subsurfaceTransportFunctions.pyx":683
14845  * cdef mt_avg,vol
14846  * for eN in range(mt.shape[0]):
14847  * mt_avg = 0.0 # <<<<<<<<<<<<<<
14848  * vol = 0.0
14849  * for k in range(mt.shape[1]):
14850  */
14851  __Pyx_INCREF(__pyx_float_0_0);
14852  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
14853 
14854  /* "subsurfaceTransportFunctions.pyx":684
14855  * for eN in range(mt.shape[0]):
14856  * mt_avg = 0.0
14857  * vol = 0.0 # <<<<<<<<<<<<<<
14858  * for k in range(mt.shape[1]):
14859  * mt_avg += dV[eN,k]*mt[eN,k]
14860  */
14861  __Pyx_INCREF(__pyx_float_0_0);
14862  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
14863 
14864  /* "subsurfaceTransportFunctions.pyx":685
14865  * mt_avg = 0.0
14866  * vol = 0.0
14867  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
14868  * mt_avg += dV[eN,k]*mt[eN,k]
14869  * vol += dV[eN,k]
14870  */
14871  __pyx_t_4 = (__pyx_v_mt->dimensions[1]);
14872  __pyx_t_5 = __pyx_t_4;
14873  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14874  __pyx_v_k = __pyx_t_6;
14875 
14876  /* "subsurfaceTransportFunctions.pyx":686
14877  * vol = 0.0
14878  * for k in range(mt.shape[1]):
14879  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
14880  * vol += dV[eN,k]
14881  * mt_avg /= vol
14882  */
14883  __pyx_t_7 = __pyx_v_eN;
14884  __pyx_t_8 = __pyx_v_k;
14885  __pyx_t_9 = -1;
14886  if (__pyx_t_7 < 0) {
14887  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
14888  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
14889  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14890  if (__pyx_t_8 < 0) {
14891  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
14892  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
14893  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14894  if (unlikely(__pyx_t_9 != -1)) {
14895  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14896  __PYX_ERR(0, 686, __pyx_L1_error)
14897  }
14898  __pyx_t_10 = __pyx_v_eN;
14899  __pyx_t_11 = __pyx_v_k;
14900  __pyx_t_9 = -1;
14901  if (__pyx_t_10 < 0) {
14902  __pyx_t_10 += __pyx_pybuffernd_mt.diminfo[0].shape;
14903  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14904  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_9 = 0;
14905  if (__pyx_t_11 < 0) {
14906  __pyx_t_11 += __pyx_pybuffernd_mt.diminfo[1].shape;
14907  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14908  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_9 = 1;
14909  if (unlikely(__pyx_t_9 != -1)) {
14910  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14911  __PYX_ERR(0, 686, __pyx_L1_error)
14912  }
14913  __pyx_t_12 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 686, __pyx_L1_error)
14914  __Pyx_GOTREF(__pyx_t_12);
14915  __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 686, __pyx_L1_error)
14916  __Pyx_GOTREF(__pyx_t_13);
14917  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
14918  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_13);
14919  __pyx_t_13 = 0;
14920 
14921  /* "subsurfaceTransportFunctions.pyx":687
14922  * for k in range(mt.shape[1]):
14923  * mt_avg += dV[eN,k]*mt[eN,k]
14924  * vol += dV[eN,k] # <<<<<<<<<<<<<<
14925  * mt_avg /= vol
14926  * for i in range(weak_residual.shape[1]):
14927  */
14928  __pyx_t_11 = __pyx_v_eN;
14929  __pyx_t_10 = __pyx_v_k;
14930  __pyx_t_9 = -1;
14931  if (__pyx_t_11 < 0) {
14932  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[0].shape;
14933  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
14934  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14935  if (__pyx_t_10 < 0) {
14936  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[1].shape;
14937  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 1;
14938  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14939  if (unlikely(__pyx_t_9 != -1)) {
14940  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14941  __PYX_ERR(0, 687, __pyx_L1_error)
14942  }
14943  __pyx_t_13 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 687, __pyx_L1_error)
14944  __Pyx_GOTREF(__pyx_t_13);
14945  __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 687, __pyx_L1_error)
14946  __Pyx_GOTREF(__pyx_t_12);
14947  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
14948  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_12);
14949  __pyx_t_12 = 0;
14950  }
14951 
14952  /* "subsurfaceTransportFunctions.pyx":688
14953  * mt_avg += dV[eN,k]*mt[eN,k]
14954  * vol += dV[eN,k]
14955  * mt_avg /= vol # <<<<<<<<<<<<<<
14956  * for i in range(weak_residual.shape[1]):
14957  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14958  */
14959  __pyx_t_12 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 688, __pyx_L1_error)
14960  __Pyx_GOTREF(__pyx_t_12);
14961  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_12);
14962  __pyx_t_12 = 0;
14963 
14964  /* "subsurfaceTransportFunctions.pyx":689
14965  * vol += dV[eN,k]
14966  * mt_avg /= vol
14967  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
14968  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14969  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
14970  */
14971  __pyx_t_4 = (__pyx_v_weak_residual->dimensions[1]);
14972  __pyx_t_5 = __pyx_t_4;
14973  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14974  __pyx_v_i = __pyx_t_6;
14975 
14976  /* "subsurfaceTransportFunctions.pyx":691
14977  * for i in range(weak_residual.shape[1]):
14978  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14979  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
14980  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
14981  * numpy.ndarray[DTYPE_t,ndim=3] w,
14982  */
14983  __pyx_t_10 = __pyx_v_eN;
14984  __pyx_t_11 = __pyx_v_k;
14985  __pyx_t_8 = __pyx_v_i;
14986  __pyx_t_9 = -1;
14987  if (__pyx_t_10 < 0) {
14988  __pyx_t_10 += __pyx_pybuffernd_w.diminfo[0].shape;
14989  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14990  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_9 = 0;
14991  if (__pyx_t_11 < 0) {
14992  __pyx_t_11 += __pyx_pybuffernd_w.diminfo[1].shape;
14993  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14994  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_9 = 1;
14995  if (__pyx_t_8 < 0) {
14996  __pyx_t_8 += __pyx_pybuffernd_w.diminfo[2].shape;
14997  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
14998  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_9 = 2;
14999  if (unlikely(__pyx_t_9 != -1)) {
15000  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15001  __PYX_ERR(0, 691, __pyx_L1_error)
15002  }
15003  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15004  __Pyx_GOTREF(__pyx_t_12);
15005  __pyx_t_13 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 691, __pyx_L1_error)
15006  __Pyx_GOTREF(__pyx_t_13);
15007  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15008  __pyx_t_8 = __pyx_v_eN;
15009  __pyx_t_11 = __pyx_v_k;
15010  __pyx_t_9 = -1;
15011  if (__pyx_t_8 < 0) {
15012  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15013  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
15014  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15015  if (__pyx_t_11 < 0) {
15016  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
15017  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
15018  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15019  if (unlikely(__pyx_t_9 != -1)) {
15020  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15021  __PYX_ERR(0, 691, __pyx_L1_error)
15022  }
15023  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15024  __Pyx_GOTREF(__pyx_t_12);
15025  __pyx_t_14 = PyNumber_Multiply(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 691, __pyx_L1_error)
15026  __Pyx_GOTREF(__pyx_t_14);
15027  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15028  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15029  __pyx_t_15 = __Pyx_PyObject_AsDouble(__pyx_t_14); if (unlikely(__pyx_t_15 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
15030  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
15031  __pyx_t_11 = __pyx_v_eN;
15032  __pyx_t_8 = __pyx_v_i;
15033  __pyx_t_9 = -1;
15034  if (__pyx_t_11 < 0) {
15035  __pyx_t_11 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
15036  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
15037  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_9 = 0;
15038  if (__pyx_t_8 < 0) {
15039  __pyx_t_8 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
15040  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15041  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_9 = 1;
15042  if (unlikely(__pyx_t_9 != -1)) {
15043  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15044  __PYX_ERR(0, 691, __pyx_L1_error)
15045  }
15046  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_15;
15047  }
15048  }
15049 
15050  /* "subsurfaceTransportFunctions.pyx":673
15051  * ##################################################
15052  *
15053  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
15054  * numpy.ndarray[DTYPE_t,ndim=3] w,
15055  * numpy.ndarray[DTYPE_t,ndim=2] dV,
15056  */
15057 
15058  /* function exit code */
15059  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15060  goto __pyx_L0;
15061  __pyx_L1_error:;
15062  __Pyx_XDECREF(__pyx_t_12);
15063  __Pyx_XDECREF(__pyx_t_13);
15064  __Pyx_XDECREF(__pyx_t_14);
15065  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15066  __Pyx_PyThreadState_declare
15067  __Pyx_PyThreadState_assign
15068  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15069  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15070  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15071  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15072  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15073  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15074  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15075  __pyx_r = NULL;
15076  goto __pyx_L2;
15077  __pyx_L0:;
15078  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15079  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15080  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15081  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15082  __pyx_L2:;
15083  __Pyx_XDECREF(__pyx_v_mt_avg);
15084  __Pyx_XDECREF(__pyx_v_vol);
15085  __Pyx_XGIVEREF(__pyx_r);
15086  __Pyx_RefNannyFinishContext();
15087  return __pyx_r;
15088 }
15089 
15090 /* "subsurfaceTransportFunctions.pyx":692
15091  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15092  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15093  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15094  * numpy.ndarray[DTYPE_t,ndim=3] w,
15095  * numpy.ndarray[DTYPE_t,ndim=3] v,
15096  */
15097 
15098 /* Python wrapper */
15099 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15100 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
15101 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
15102 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15103  PyArrayObject *__pyx_v_dmt = 0;
15104  PyArrayObject *__pyx_v_w = 0;
15105  PyArrayObject *__pyx_v_v = 0;
15106  PyArrayObject *__pyx_v_dV = 0;
15107  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
15108  int __pyx_lineno = 0;
15109  const char *__pyx_filename = NULL;
15110  int __pyx_clineno = 0;
15111  PyObject *__pyx_r = 0;
15112  __Pyx_RefNannyDeclarations
15113  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
15114  {
15115  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
15116  PyObject* values[5] = {0,0,0,0,0};
15117  if (unlikely(__pyx_kwds)) {
15118  Py_ssize_t kw_args;
15119  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15120  switch (pos_args) {
15121  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15122  CYTHON_FALLTHROUGH;
15123  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15124  CYTHON_FALLTHROUGH;
15125  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15126  CYTHON_FALLTHROUGH;
15127  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15128  CYTHON_FALLTHROUGH;
15129  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15130  CYTHON_FALLTHROUGH;
15131  case 0: break;
15132  default: goto __pyx_L5_argtuple_error;
15133  }
15134  kw_args = PyDict_Size(__pyx_kwds);
15135  switch (pos_args) {
15136  case 0:
15137  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
15138  else goto __pyx_L5_argtuple_error;
15139  CYTHON_FALLTHROUGH;
15140  case 1:
15141  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
15142  else {
15143  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); __PYX_ERR(0, 692, __pyx_L3_error)
15144  }
15145  CYTHON_FALLTHROUGH;
15146  case 2:
15147  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15148  else {
15149  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); __PYX_ERR(0, 692, __pyx_L3_error)
15150  }
15151  CYTHON_FALLTHROUGH;
15152  case 3:
15153  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15154  else {
15155  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); __PYX_ERR(0, 692, __pyx_L3_error)
15156  }
15157  CYTHON_FALLTHROUGH;
15158  case 4:
15159  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
15160  else {
15161  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); __PYX_ERR(0, 692, __pyx_L3_error)
15162  }
15163  }
15164  if (unlikely(kw_args > 0)) {
15165  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
15166  }
15167  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15168  goto __pyx_L5_argtuple_error;
15169  } else {
15170  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15171  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15172  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15173  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15174  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15175  }
15176  __pyx_v_dmt = ((PyArrayObject *)values[0]);
15177  __pyx_v_w = ((PyArrayObject *)values[1]);
15178  __pyx_v_v = ((PyArrayObject *)values[2]);
15179  __pyx_v_dV = ((PyArrayObject *)values[3]);
15180  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
15181  }
15182  goto __pyx_L4_argument_unpacking_done;
15183  __pyx_L5_argtuple_error:;
15184  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
15185  __pyx_L3_error:;
15186  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15187  __Pyx_RefNannyFinishContext();
15188  return NULL;
15189  __pyx_L4_argument_unpacking_done:;
15190  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) __PYX_ERR(0, 692, __pyx_L1_error)
15191  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 693, __pyx_L1_error)
15192  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 694, __pyx_L1_error)
15193  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 695, __pyx_L1_error)
15194  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) __PYX_ERR(0, 696, __pyx_L1_error)
15195  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
15196 
15197  /* function exit code */
15198  goto __pyx_L0;
15199  __pyx_L1_error:;
15200  __pyx_r = NULL;
15201  __pyx_L0:;
15202  __Pyx_RefNannyFinishContext();
15203  return __pyx_r;
15204 }
15205 
15206 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual) {
15207  int __pyx_v_eN;
15208  int __pyx_v_i;
15209  int __pyx_v_j;
15210  int __pyx_v_k;
15211  double __pyx_v_dmtj_avg;
15212  double __pyx_v_vol;
15213  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15214  __Pyx_Buffer __pyx_pybuffer_dV;
15215  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
15216  __Pyx_Buffer __pyx_pybuffer_dmt;
15217  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
15218  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
15219  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15220  __Pyx_Buffer __pyx_pybuffer_v;
15221  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
15222  __Pyx_Buffer __pyx_pybuffer_w;
15223  PyObject *__pyx_r = NULL;
15224  __Pyx_RefNannyDeclarations
15225  npy_intp __pyx_t_1;
15226  npy_intp __pyx_t_2;
15227  int __pyx_t_3;
15228  npy_intp __pyx_t_4;
15229  npy_intp __pyx_t_5;
15230  int __pyx_t_6;
15231  Py_ssize_t __pyx_t_7;
15232  Py_ssize_t __pyx_t_8;
15233  int __pyx_t_9;
15234  npy_intp __pyx_t_10;
15235  npy_intp __pyx_t_11;
15236  npy_intp __pyx_t_12;
15237  npy_intp __pyx_t_13;
15238  int __pyx_t_14;
15239  int __pyx_t_15;
15240  Py_ssize_t __pyx_t_16;
15241  Py_ssize_t __pyx_t_17;
15242  Py_ssize_t __pyx_t_18;
15243  Py_ssize_t __pyx_t_19;
15244  Py_ssize_t __pyx_t_20;
15245  Py_ssize_t __pyx_t_21;
15246  int __pyx_lineno = 0;
15247  const char *__pyx_filename = NULL;
15248  int __pyx_clineno = 0;
15249  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
15250  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
15251  __pyx_pybuffer_dmt.refcount = 0;
15252  __pyx_pybuffernd_dmt.data = NULL;
15253  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
15254  __pyx_pybuffer_w.pybuffer.buf = NULL;
15255  __pyx_pybuffer_w.refcount = 0;
15256  __pyx_pybuffernd_w.data = NULL;
15257  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
15258  __pyx_pybuffer_v.pybuffer.buf = NULL;
15259  __pyx_pybuffer_v.refcount = 0;
15260  __pyx_pybuffernd_v.data = NULL;
15261  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15262  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15263  __pyx_pybuffer_dV.refcount = 0;
15264  __pyx_pybuffernd_dV.data = NULL;
15265  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15266  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
15267  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
15268  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
15269  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
15270  {
15271  __Pyx_BufFmt_StackElem __pyx_stack[1];
15272  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15273  }
15274  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
15275  {
15276  __Pyx_BufFmt_StackElem __pyx_stack[1];
15277  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15278  }
15279  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
15280  {
15281  __Pyx_BufFmt_StackElem __pyx_stack[1];
15282  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15283  }
15284  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
15285  {
15286  __Pyx_BufFmt_StackElem __pyx_stack[1];
15287  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15288  }
15289  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15290  {
15291  __Pyx_BufFmt_StackElem __pyx_stack[1];
15292  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15293  }
15294  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
15295 
15296  /* "subsurfaceTransportFunctions.pyx":702
15297  * cdef int eN,i,j,k
15298  * cdef double dmtj_avg,vol
15299  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
15300  * vol = 0.0 #should I save a loop?
15301  * for k in range(dmt.shape[1]):
15302  */
15303  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
15304  __pyx_t_2 = __pyx_t_1;
15305  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15306  __pyx_v_eN = __pyx_t_3;
15307 
15308  /* "subsurfaceTransportFunctions.pyx":703
15309  * cdef double dmtj_avg,vol
15310  * for eN in range(dmt.shape[0]):
15311  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
15312  * for k in range(dmt.shape[1]):
15313  * vol += dV[eN,k]
15314  */
15315  __pyx_v_vol = 0.0;
15316 
15317  /* "subsurfaceTransportFunctions.pyx":704
15318  * for eN in range(dmt.shape[0]):
15319  * vol = 0.0 #should I save a loop?
15320  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15321  * vol += dV[eN,k]
15322  * for i in range(w.shape[2]):
15323  */
15324  __pyx_t_4 = (__pyx_v_dmt->dimensions[1]);
15325  __pyx_t_5 = __pyx_t_4;
15326  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15327  __pyx_v_k = __pyx_t_6;
15328 
15329  /* "subsurfaceTransportFunctions.pyx":705
15330  * vol = 0.0 #should I save a loop?
15331  * for k in range(dmt.shape[1]):
15332  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15333  * for i in range(w.shape[2]):
15334  * for j in range(v.shape[2]):
15335  */
15336  __pyx_t_7 = __pyx_v_eN;
15337  __pyx_t_8 = __pyx_v_k;
15338  __pyx_t_9 = -1;
15339  if (__pyx_t_7 < 0) {
15340  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
15341  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
15342  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15343  if (__pyx_t_8 < 0) {
15344  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
15345  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15346  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15347  if (unlikely(__pyx_t_9 != -1)) {
15348  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15349  __PYX_ERR(0, 705, __pyx_L1_error)
15350  }
15351  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
15352  }
15353 
15354  /* "subsurfaceTransportFunctions.pyx":706
15355  * for k in range(dmt.shape[1]):
15356  * vol += dV[eN,k]
15357  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
15358  * for j in range(v.shape[2]):
15359  * dmtj_avg = 0.0
15360  */
15361  __pyx_t_4 = (__pyx_v_w->dimensions[2]);
15362  __pyx_t_5 = __pyx_t_4;
15363  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15364  __pyx_v_i = __pyx_t_6;
15365 
15366  /* "subsurfaceTransportFunctions.pyx":707
15367  * vol += dV[eN,k]
15368  * for i in range(w.shape[2]):
15369  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
15370  * dmtj_avg = 0.0
15371  * for k in range(dmt.shape[1]):
15372  */
15373  __pyx_t_10 = (__pyx_v_v->dimensions[2]);
15374  __pyx_t_11 = __pyx_t_10;
15375  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
15376  __pyx_v_j = __pyx_t_9;
15377 
15378  /* "subsurfaceTransportFunctions.pyx":708
15379  * for i in range(w.shape[2]):
15380  * for j in range(v.shape[2]):
15381  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
15382  * for k in range(dmt.shape[1]):
15383  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15384  */
15385  __pyx_v_dmtj_avg = 0.0;
15386 
15387  /* "subsurfaceTransportFunctions.pyx":709
15388  * for j in range(v.shape[2]):
15389  * dmtj_avg = 0.0
15390  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15391  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15392  * dmtj_avg /= vol
15393  */
15394  __pyx_t_12 = (__pyx_v_dmt->dimensions[1]);
15395  __pyx_t_13 = __pyx_t_12;
15396  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
15397  __pyx_v_k = __pyx_t_14;
15398 
15399  /* "subsurfaceTransportFunctions.pyx":710
15400  * dmtj_avg = 0.0
15401  * for k in range(dmt.shape[1]):
15402  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
15403  * dmtj_avg /= vol
15404  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15405  */
15406  __pyx_t_8 = __pyx_v_eN;
15407  __pyx_t_7 = __pyx_v_k;
15408  __pyx_t_15 = -1;
15409  if (__pyx_t_8 < 0) {
15410  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15411  if (unlikely(__pyx_t_8 < 0)) __pyx_t_15 = 0;
15412  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_15 = 0;
15413  if (__pyx_t_7 < 0) {
15414  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
15415  if (unlikely(__pyx_t_7 < 0)) __pyx_t_15 = 1;
15416  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_15 = 1;
15417  if (unlikely(__pyx_t_15 != -1)) {
15418  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15419  __PYX_ERR(0, 710, __pyx_L1_error)
15420  }
15421  __pyx_t_16 = __pyx_v_eN;
15422  __pyx_t_17 = __pyx_v_k;
15423  __pyx_t_15 = -1;
15424  if (__pyx_t_16 < 0) {
15425  __pyx_t_16 += __pyx_pybuffernd_dmt.diminfo[0].shape;
15426  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
15427  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_15 = 0;
15428  if (__pyx_t_17 < 0) {
15429  __pyx_t_17 += __pyx_pybuffernd_dmt.diminfo[1].shape;
15430  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
15431  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_15 = 1;
15432  if (unlikely(__pyx_t_15 != -1)) {
15433  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15434  __PYX_ERR(0, 710, __pyx_L1_error)
15435  }
15436  __pyx_t_18 = __pyx_v_eN;
15437  __pyx_t_19 = __pyx_v_k;
15438  __pyx_t_20 = __pyx_v_j;
15439  __pyx_t_15 = -1;
15440  if (__pyx_t_18 < 0) {
15441  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
15442  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0;
15443  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
15444  if (__pyx_t_19 < 0) {
15445  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
15446  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 1;
15447  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
15448  if (__pyx_t_20 < 0) {
15449  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
15450  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 2;
15451  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
15452  if (unlikely(__pyx_t_15 != -1)) {
15453  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15454  __PYX_ERR(0, 710, __pyx_L1_error)
15455  }
15456  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides))));
15457  }
15458 
15459  /* "subsurfaceTransportFunctions.pyx":711
15460  * for k in range(dmt.shape[1]):
15461  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15462  * dmtj_avg /= vol # <<<<<<<<<<<<<<
15463  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15464  *
15465  */
15466  if (unlikely(__pyx_v_vol == 0)) {
15467  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15468  __PYX_ERR(0, 711, __pyx_L1_error)
15469  }
15470  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
15471 
15472  /* "subsurfaceTransportFunctions.pyx":712
15473  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15474  * dmtj_avg /= vol
15475  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
15476  *
15477  * ########################################################################
15478  */
15479  __pyx_t_20 = __pyx_v_eN;
15480  __pyx_t_19 = __pyx_v_k;
15481  __pyx_t_18 = __pyx_v_i;
15482  __pyx_t_14 = -1;
15483  if (__pyx_t_20 < 0) {
15484  __pyx_t_20 += __pyx_pybuffernd_w.diminfo[0].shape;
15485  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 0;
15486  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_14 = 0;
15487  if (__pyx_t_19 < 0) {
15488  __pyx_t_19 += __pyx_pybuffernd_w.diminfo[1].shape;
15489  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 1;
15490  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_14 = 1;
15491  if (__pyx_t_18 < 0) {
15492  __pyx_t_18 += __pyx_pybuffernd_w.diminfo[2].shape;
15493  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 2;
15494  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_14 = 2;
15495  if (unlikely(__pyx_t_14 != -1)) {
15496  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15497  __PYX_ERR(0, 712, __pyx_L1_error)
15498  }
15499  __pyx_t_17 = __pyx_v_eN;
15500  __pyx_t_16 = __pyx_v_k;
15501  __pyx_t_14 = -1;
15502  if (__pyx_t_17 < 0) {
15503  __pyx_t_17 += __pyx_pybuffernd_dV.diminfo[0].shape;
15504  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 0;
15505  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_14 = 0;
15506  if (__pyx_t_16 < 0) {
15507  __pyx_t_16 += __pyx_pybuffernd_dV.diminfo[1].shape;
15508  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
15509  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_14 = 1;
15510  if (unlikely(__pyx_t_14 != -1)) {
15511  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15512  __PYX_ERR(0, 712, __pyx_L1_error)
15513  }
15514  __pyx_t_7 = __pyx_v_eN;
15515  __pyx_t_8 = __pyx_v_i;
15516  __pyx_t_21 = __pyx_v_j;
15517  __pyx_t_14 = -1;
15518  if (__pyx_t_7 < 0) {
15519  __pyx_t_7 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
15520  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 0;
15521  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_14 = 0;
15522  if (__pyx_t_8 < 0) {
15523  __pyx_t_8 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
15524  if (unlikely(__pyx_t_8 < 0)) __pyx_t_14 = 1;
15525  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_14 = 1;
15526  if (__pyx_t_21 < 0) {
15527  __pyx_t_21 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
15528  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
15529  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_14 = 2;
15530  if (unlikely(__pyx_t_14 != -1)) {
15531  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15532  __PYX_ERR(0, 712, __pyx_L1_error)
15533  }
15534  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_dV.diminfo[1].strides)));
15535  }
15536  }
15537  }
15538 
15539  /* "subsurfaceTransportFunctions.pyx":692
15540  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15541  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15542  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15543  * numpy.ndarray[DTYPE_t,ndim=3] w,
15544  * numpy.ndarray[DTYPE_t,ndim=3] v,
15545  */
15546 
15547  /* function exit code */
15548  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15549  goto __pyx_L0;
15550  __pyx_L1_error:;
15551  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15552  __Pyx_PyThreadState_declare
15553  __Pyx_PyThreadState_assign
15554  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15555  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15556  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15557  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15558  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15559  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15560  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15561  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15562  __pyx_r = NULL;
15563  goto __pyx_L2;
15564  __pyx_L0:;
15565  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15566  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15567  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15568  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15569  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15570  __pyx_L2:;
15571  __Pyx_XGIVEREF(__pyx_r);
15572  __Pyx_RefNannyFinishContext();
15573  return __pyx_r;
15574 }
15575 
15576 /* "subsurfaceTransportFunctions.pyx":717
15577  * #ELLAM
15578  * ########################################################################
15579  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15580  * numpy.ndarray[DTYPE_t,ndim=4] n,
15581  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15582  */
15583 
15584 /* Python wrapper */
15585 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15586 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
15587 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15588  PyArrayObject *__pyx_v_v = 0;
15589  PyArrayObject *__pyx_v_n = 0;
15590  PyArrayObject *__pyx_v_dS = 0;
15591  PyArrayObject *__pyx_v_flux = 0;
15592  int __pyx_lineno = 0;
15593  const char *__pyx_filename = NULL;
15594  int __pyx_clineno = 0;
15595  PyObject *__pyx_r = 0;
15596  __Pyx_RefNannyDeclarations
15597  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
15598  {
15599  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
15600  PyObject* values[4] = {0,0,0,0};
15601  if (unlikely(__pyx_kwds)) {
15602  Py_ssize_t kw_args;
15603  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15604  switch (pos_args) {
15605  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15606  CYTHON_FALLTHROUGH;
15607  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15608  CYTHON_FALLTHROUGH;
15609  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15610  CYTHON_FALLTHROUGH;
15611  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15612  CYTHON_FALLTHROUGH;
15613  case 0: break;
15614  default: goto __pyx_L5_argtuple_error;
15615  }
15616  kw_args = PyDict_Size(__pyx_kwds);
15617  switch (pos_args) {
15618  case 0:
15619  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15620  else goto __pyx_L5_argtuple_error;
15621  CYTHON_FALLTHROUGH;
15622  case 1:
15623  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
15624  else {
15625  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
15626  }
15627  CYTHON_FALLTHROUGH;
15628  case 2:
15629  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
15630  else {
15631  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
15632  }
15633  CYTHON_FALLTHROUGH;
15634  case 3:
15635  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
15636  else {
15637  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
15638  }
15639  }
15640  if (unlikely(kw_args > 0)) {
15641  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
15642  }
15643  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15644  goto __pyx_L5_argtuple_error;
15645  } else {
15646  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15647  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15648  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15649  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15650  }
15651  __pyx_v_v = ((PyArrayObject *)values[0]);
15652  __pyx_v_n = ((PyArrayObject *)values[1]);
15653  __pyx_v_dS = ((PyArrayObject *)values[2]);
15654  __pyx_v_flux = ((PyArrayObject *)values[3]);
15655  }
15656  goto __pyx_L4_argument_unpacking_done;
15657  __pyx_L5_argtuple_error:;
15658  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
15659  __pyx_L3_error:;
15660  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15661  __Pyx_RefNannyFinishContext();
15662  return NULL;
15663  __pyx_L4_argument_unpacking_done:;
15664  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 717, __pyx_L1_error)
15665  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 718, __pyx_L1_error)
15666  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) __PYX_ERR(0, 719, __pyx_L1_error)
15667  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) __PYX_ERR(0, 720, __pyx_L1_error)
15668  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
15669 
15670  /* function exit code */
15671  goto __pyx_L0;
15672  __pyx_L1_error:;
15673  __pyx_r = NULL;
15674  __pyx_L0:;
15675  __Pyx_RefNannyFinishContext();
15676  return __pyx_r;
15677 }
15678 
15679 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux) {
15680  int __pyx_v_eN;
15681  int __pyx_v_ebN;
15682  int __pyx_v_kb;
15683  double __pyx_v_integral;
15684  npy_intp __pyx_v_I;
15685  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
15686  __Pyx_Buffer __pyx_pybuffer_dS;
15687  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
15688  __Pyx_Buffer __pyx_pybuffer_flux;
15689  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
15690  __Pyx_Buffer __pyx_pybuffer_n;
15691  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15692  __Pyx_Buffer __pyx_pybuffer_v;
15693  PyObject *__pyx_r = NULL;
15694  __Pyx_RefNannyDeclarations
15695  npy_intp __pyx_t_1;
15696  npy_intp __pyx_t_2;
15697  int __pyx_t_3;
15698  npy_intp __pyx_t_4;
15699  npy_intp __pyx_t_5;
15700  int __pyx_t_6;
15701  npy_intp __pyx_t_7;
15702  npy_intp __pyx_t_8;
15703  int __pyx_t_9;
15704  npy_intp __pyx_t_10;
15705  npy_intp __pyx_t_11;
15706  npy_intp __pyx_t_12;
15707  Py_ssize_t __pyx_t_13;
15708  Py_ssize_t __pyx_t_14;
15709  Py_ssize_t __pyx_t_15;
15710  Py_ssize_t __pyx_t_16;
15711  int __pyx_t_17;
15712  Py_ssize_t __pyx_t_18;
15713  Py_ssize_t __pyx_t_19;
15714  Py_ssize_t __pyx_t_20;
15715  Py_ssize_t __pyx_t_21;
15716  Py_ssize_t __pyx_t_22;
15717  Py_ssize_t __pyx_t_23;
15718  Py_ssize_t __pyx_t_24;
15719  int __pyx_lineno = 0;
15720  const char *__pyx_filename = NULL;
15721  int __pyx_clineno = 0;
15722  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
15723  __pyx_pybuffer_v.pybuffer.buf = NULL;
15724  __pyx_pybuffer_v.refcount = 0;
15725  __pyx_pybuffernd_v.data = NULL;
15726  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15727  __pyx_pybuffer_n.pybuffer.buf = NULL;
15728  __pyx_pybuffer_n.refcount = 0;
15729  __pyx_pybuffernd_n.data = NULL;
15730  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
15731  __pyx_pybuffer_dS.pybuffer.buf = NULL;
15732  __pyx_pybuffer_dS.refcount = 0;
15733  __pyx_pybuffernd_dS.data = NULL;
15734  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
15735  __pyx_pybuffer_flux.pybuffer.buf = NULL;
15736  __pyx_pybuffer_flux.refcount = 0;
15737  __pyx_pybuffernd_flux.data = NULL;
15738  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
15739  {
15740  __Pyx_BufFmt_StackElem __pyx_stack[1];
15741  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15742  }
15743  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
15744  {
15745  __Pyx_BufFmt_StackElem __pyx_stack[1];
15746  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15747  }
15748  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
15749  {
15750  __Pyx_BufFmt_StackElem __pyx_stack[1];
15751  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15752  }
15753  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
15754  {
15755  __Pyx_BufFmt_StackElem __pyx_stack[1];
15756  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15757  }
15758  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
15759 
15760  /* "subsurfaceTransportFunctions.pyx":724
15761  * cdef int eN,ebN,kb
15762  * cdef double integral
15763  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
15764  * for ebN in range(n.shape[1]):
15765  * integral = 0.0
15766  */
15767  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
15768  __pyx_t_2 = __pyx_t_1;
15769  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15770  __pyx_v_eN = __pyx_t_3;
15771 
15772  /* "subsurfaceTransportFunctions.pyx":725
15773  * cdef double integral
15774  * for eN in range(n.shape[0]):
15775  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
15776  * integral = 0.0
15777  * for kb in range(n.shape[2]):
15778  */
15779  __pyx_t_4 = (__pyx_v_n->dimensions[1]);
15780  __pyx_t_5 = __pyx_t_4;
15781  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15782  __pyx_v_ebN = __pyx_t_6;
15783 
15784  /* "subsurfaceTransportFunctions.pyx":726
15785  * for eN in range(n.shape[0]):
15786  * for ebN in range(n.shape[1]):
15787  * integral = 0.0 # <<<<<<<<<<<<<<
15788  * for kb in range(n.shape[2]):
15789  * for I in range(n.shape[3]):
15790  */
15791  __pyx_v_integral = 0.0;
15792 
15793  /* "subsurfaceTransportFunctions.pyx":727
15794  * for ebN in range(n.shape[1]):
15795  * integral = 0.0
15796  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
15797  * for I in range(n.shape[3]):
15798  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15799  */
15800  __pyx_t_7 = (__pyx_v_n->dimensions[2]);
15801  __pyx_t_8 = __pyx_t_7;
15802  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15803  __pyx_v_kb = __pyx_t_9;
15804 
15805  /* "subsurfaceTransportFunctions.pyx":728
15806  * integral = 0.0
15807  * for kb in range(n.shape[2]):
15808  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
15809  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15810  * flux[eN,ebN] = integral
15811  */
15812  __pyx_t_10 = (__pyx_v_n->dimensions[3]);
15813  __pyx_t_11 = __pyx_t_10;
15814  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
15815  __pyx_v_I = __pyx_t_12;
15816 
15817  /* "subsurfaceTransportFunctions.pyx":729
15818  * for kb in range(n.shape[2]):
15819  * for I in range(n.shape[3]):
15820  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
15821  * flux[eN,ebN] = integral
15822  *
15823  */
15824  __pyx_t_13 = __pyx_v_eN;
15825  __pyx_t_14 = __pyx_v_ebN;
15826  __pyx_t_15 = __pyx_v_kb;
15827  __pyx_t_16 = __pyx_v_I;
15828  __pyx_t_17 = -1;
15829  if (__pyx_t_13 < 0) {
15830  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
15831  if (unlikely(__pyx_t_13 < 0)) __pyx_t_17 = 0;
15832  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15833  if (__pyx_t_14 < 0) {
15834  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
15835  if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 1;
15836  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15837  if (__pyx_t_15 < 0) {
15838  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
15839  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 2;
15840  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15841  if (__pyx_t_16 < 0) {
15842  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
15843  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 3;
15844  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_17 = 3;
15845  if (unlikely(__pyx_t_17 != -1)) {
15846  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15847  __PYX_ERR(0, 729, __pyx_L1_error)
15848  }
15849  __pyx_t_18 = __pyx_v_eN;
15850  __pyx_t_19 = __pyx_v_ebN;
15851  __pyx_t_20 = __pyx_v_kb;
15852  __pyx_t_21 = __pyx_v_I;
15853  __pyx_t_17 = -1;
15854  if (__pyx_t_18 < 0) {
15855  __pyx_t_18 += __pyx_pybuffernd_n.diminfo[0].shape;
15856  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15857  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
15858  if (__pyx_t_19 < 0) {
15859  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[1].shape;
15860  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15861  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_17 = 1;
15862  if (__pyx_t_20 < 0) {
15863  __pyx_t_20 += __pyx_pybuffernd_n.diminfo[2].shape;
15864  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 2;
15865  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_17 = 2;
15866  if (__pyx_t_21 < 0) {
15867  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[3].shape;
15868  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 3;
15869  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_17 = 3;
15870  if (unlikely(__pyx_t_17 != -1)) {
15871  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15872  __PYX_ERR(0, 729, __pyx_L1_error)
15873  }
15874  __pyx_t_22 = __pyx_v_eN;
15875  __pyx_t_23 = __pyx_v_ebN;
15876  __pyx_t_24 = __pyx_v_kb;
15877  __pyx_t_17 = -1;
15878  if (__pyx_t_22 < 0) {
15879  __pyx_t_22 += __pyx_pybuffernd_dS.diminfo[0].shape;
15880  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 0;
15881  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_17 = 0;
15882  if (__pyx_t_23 < 0) {
15883  __pyx_t_23 += __pyx_pybuffernd_dS.diminfo[1].shape;
15884  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 1;
15885  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_17 = 1;
15886  if (__pyx_t_24 < 0) {
15887  __pyx_t_24 += __pyx_pybuffernd_dS.diminfo[2].shape;
15888  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 2;
15889  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_17 = 2;
15890  if (unlikely(__pyx_t_17 != -1)) {
15891  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15892  __PYX_ERR(0, 729, __pyx_L1_error)
15893  }
15894  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_21, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_dS.diminfo[2].strides))));
15895  }
15896  }
15897 
15898  /* "subsurfaceTransportFunctions.pyx":730
15899  * for I in range(n.shape[3]):
15900  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15901  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
15902  *
15903  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
15904  */
15905  __pyx_t_24 = __pyx_v_eN;
15906  __pyx_t_23 = __pyx_v_ebN;
15907  __pyx_t_9 = -1;
15908  if (__pyx_t_24 < 0) {
15909  __pyx_t_24 += __pyx_pybuffernd_flux.diminfo[0].shape;
15910  if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 0;
15911  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_9 = 0;
15912  if (__pyx_t_23 < 0) {
15913  __pyx_t_23 += __pyx_pybuffernd_flux.diminfo[1].shape;
15914  if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 1;
15915  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_9 = 1;
15916  if (unlikely(__pyx_t_9 != -1)) {
15917  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15918  __PYX_ERR(0, 730, __pyx_L1_error)
15919  }
15920  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
15921  }
15922  }
15923 
15924  /* "subsurfaceTransportFunctions.pyx":717
15925  * #ELLAM
15926  * ########################################################################
15927  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15928  * numpy.ndarray[DTYPE_t,ndim=4] n,
15929  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15930  */
15931 
15932  /* function exit code */
15933  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15934  goto __pyx_L0;
15935  __pyx_L1_error:;
15936  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15937  __Pyx_PyThreadState_declare
15938  __Pyx_PyThreadState_assign
15939  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15940  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15941  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15942  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15943  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15944  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15945  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15946  __pyx_r = NULL;
15947  goto __pyx_L2;
15948  __pyx_L0:;
15949  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15950  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15951  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15952  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15953  __pyx_L2:;
15954  __Pyx_XGIVEREF(__pyx_r);
15955  __Pyx_RefNannyFinishContext();
15956  return __pyx_r;
15957 }
15958 
15959 /* "subsurfaceTransportFunctions.pyx":732
15960  * flux[eN,ebN] = integral
15961  *
15962  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
15963  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
15964  * numpy.ndarray[DTYPE_t,ndim=2] dm,
15965  */
15966 
15967 /* Python wrapper */
15968 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15969 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
15970 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
15971 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15972  PyArrayObject *__pyx_v_df = 0;
15973  PyArrayObject *__pyx_v_characteristic_velocity = 0;
15974  PyArrayObject *__pyx_v_dm = 0;
15975  PyArrayObject *__pyx_v_dV = 0;
15976  int __pyx_lineno = 0;
15977  const char *__pyx_filename = NULL;
15978  int __pyx_clineno = 0;
15979  PyObject *__pyx_r = 0;
15980  __Pyx_RefNannyDeclarations
15981  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
15982  {
15983  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
15984  PyObject* values[4] = {0,0,0,0};
15985  if (unlikely(__pyx_kwds)) {
15986  Py_ssize_t kw_args;
15987  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15988  switch (pos_args) {
15989  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15990  CYTHON_FALLTHROUGH;
15991  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15992  CYTHON_FALLTHROUGH;
15993  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15994  CYTHON_FALLTHROUGH;
15995  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15996  CYTHON_FALLTHROUGH;
15997  case 0: break;
15998  default: goto __pyx_L5_argtuple_error;
15999  }
16000  kw_args = PyDict_Size(__pyx_kwds);
16001  switch (pos_args) {
16002  case 0:
16003  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
16004  else goto __pyx_L5_argtuple_error;
16005  CYTHON_FALLTHROUGH;
16006  case 1:
16007  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
16008  else {
16009  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); __PYX_ERR(0, 732, __pyx_L3_error)
16010  }
16011  CYTHON_FALLTHROUGH;
16012  case 2:
16013  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16014  else {
16015  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); __PYX_ERR(0, 732, __pyx_L3_error)
16016  }
16017  CYTHON_FALLTHROUGH;
16018  case 3:
16019  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16020  else {
16021  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); __PYX_ERR(0, 732, __pyx_L3_error)
16022  }
16023  }
16024  if (unlikely(kw_args > 0)) {
16025  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
16026  }
16027  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
16028  goto __pyx_L5_argtuple_error;
16029  } else {
16030  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16031  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16032  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16033  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16034  }
16035  __pyx_v_df = ((PyArrayObject *)values[0]);
16036  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
16037  __pyx_v_dm = ((PyArrayObject *)values[2]);
16038  __pyx_v_dV = ((PyArrayObject *)values[3]);
16039  }
16040  goto __pyx_L4_argument_unpacking_done;
16041  __pyx_L5_argtuple_error:;
16042  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
16043  __pyx_L3_error:;
16044  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16045  __Pyx_RefNannyFinishContext();
16046  return NULL;
16047  __pyx_L4_argument_unpacking_done:;
16048  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 732, __pyx_L1_error)
16049  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
16050  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 734, __pyx_L1_error)
16051  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 735, __pyx_L1_error)
16052  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
16053 
16054  /* function exit code */
16055  goto __pyx_L0;
16056  __pyx_L1_error:;
16057  __pyx_r = NULL;
16058  __pyx_L0:;
16059  __Pyx_RefNannyFinishContext();
16060  return __pyx_r;
16061 }
16062 
16063 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16064  int __pyx_v_eN;
16065  int __pyx_v_k;
16066  int __pyx_v_I;
16067  double __pyx_v_omega_e;
16068  double __pyx_v_vol_e;
16069  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
16070  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
16071  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16072  __Pyx_Buffer __pyx_pybuffer_dV;
16073  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
16074  __Pyx_Buffer __pyx_pybuffer_df;
16075  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16076  __Pyx_Buffer __pyx_pybuffer_dm;
16077  PyObject *__pyx_r = NULL;
16078  __Pyx_RefNannyDeclarations
16079  npy_intp __pyx_t_1;
16080  npy_intp __pyx_t_2;
16081  int __pyx_t_3;
16082  npy_intp __pyx_t_4;
16083  npy_intp __pyx_t_5;
16084  int __pyx_t_6;
16085  Py_ssize_t __pyx_t_7;
16086  Py_ssize_t __pyx_t_8;
16087  int __pyx_t_9;
16088  Py_ssize_t __pyx_t_10;
16089  Py_ssize_t __pyx_t_11;
16090  npy_intp __pyx_t_12;
16091  npy_intp __pyx_t_13;
16092  int __pyx_t_14;
16093  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
16094  double __pyx_t_16;
16095  int __pyx_lineno = 0;
16096  const char *__pyx_filename = NULL;
16097  int __pyx_clineno = 0;
16098  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
16099  __pyx_pybuffer_df.pybuffer.buf = NULL;
16100  __pyx_pybuffer_df.refcount = 0;
16101  __pyx_pybuffernd_df.data = NULL;
16102  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
16103  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
16104  __pyx_pybuffer_characteristic_velocity.refcount = 0;
16105  __pyx_pybuffernd_characteristic_velocity.data = NULL;
16106  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
16107  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16108  __pyx_pybuffer_dm.refcount = 0;
16109  __pyx_pybuffernd_dm.data = NULL;
16110  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16111  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16112  __pyx_pybuffer_dV.refcount = 0;
16113  __pyx_pybuffernd_dV.data = NULL;
16114  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16115  {
16116  __Pyx_BufFmt_StackElem __pyx_stack[1];
16117  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16118  }
16119  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
16120  {
16121  __Pyx_BufFmt_StackElem __pyx_stack[1];
16122  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16123  }
16124  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
16125  {
16126  __Pyx_BufFmt_StackElem __pyx_stack[1];
16127  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16128  }
16129  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16130  {
16131  __Pyx_BufFmt_StackElem __pyx_stack[1];
16132  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16133  }
16134  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16135 
16136  /* "subsurfaceTransportFunctions.pyx":743
16137  * cdef double omega_e, vol_e
16138  *
16139  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16140  * omega_e = 0.0
16141  * vol_e = 0.0
16142  */
16143  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16144  __pyx_t_2 = __pyx_t_1;
16145  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16146  __pyx_v_eN = __pyx_t_3;
16147 
16148  /* "subsurfaceTransportFunctions.pyx":744
16149  *
16150  * for eN in range(dm.shape[0]):
16151  * omega_e = 0.0 # <<<<<<<<<<<<<<
16152  * vol_e = 0.0
16153  * for k in range(dm.shape[1]):
16154  */
16155  __pyx_v_omega_e = 0.0;
16156 
16157  /* "subsurfaceTransportFunctions.pyx":745
16158  * for eN in range(dm.shape[0]):
16159  * omega_e = 0.0
16160  * vol_e = 0.0 # <<<<<<<<<<<<<<
16161  * for k in range(dm.shape[1]):
16162  * vol_e += dV[eN,k]
16163  */
16164  __pyx_v_vol_e = 0.0;
16165 
16166  /* "subsurfaceTransportFunctions.pyx":746
16167  * omega_e = 0.0
16168  * vol_e = 0.0
16169  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16170  * vol_e += dV[eN,k]
16171  * omega_e += dV[eN,k]*dm[eN,k]
16172  */
16173  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16174  __pyx_t_5 = __pyx_t_4;
16175  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16176  __pyx_v_k = __pyx_t_6;
16177 
16178  /* "subsurfaceTransportFunctions.pyx":747
16179  * vol_e = 0.0
16180  * for k in range(dm.shape[1]):
16181  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16182  * omega_e += dV[eN,k]*dm[eN,k]
16183  * for k in range(df.shape[1]):
16184  */
16185  __pyx_t_7 = __pyx_v_eN;
16186  __pyx_t_8 = __pyx_v_k;
16187  __pyx_t_9 = -1;
16188  if (__pyx_t_7 < 0) {
16189  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16190  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16191  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16192  if (__pyx_t_8 < 0) {
16193  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16194  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16195  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16196  if (unlikely(__pyx_t_9 != -1)) {
16197  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16198  __PYX_ERR(0, 747, __pyx_L1_error)
16199  }
16200  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16201 
16202  /* "subsurfaceTransportFunctions.pyx":748
16203  * for k in range(dm.shape[1]):
16204  * vol_e += dV[eN,k]
16205  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16206  * for k in range(df.shape[1]):
16207  * for I in range(df.shape[2]):
16208  */
16209  __pyx_t_8 = __pyx_v_eN;
16210  __pyx_t_7 = __pyx_v_k;
16211  __pyx_t_9 = -1;
16212  if (__pyx_t_8 < 0) {
16213  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16214  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
16215  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16216  if (__pyx_t_7 < 0) {
16217  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
16218  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16219  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16220  if (unlikely(__pyx_t_9 != -1)) {
16221  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16222  __PYX_ERR(0, 748, __pyx_L1_error)
16223  }
16224  __pyx_t_10 = __pyx_v_eN;
16225  __pyx_t_11 = __pyx_v_k;
16226  __pyx_t_9 = -1;
16227  if (__pyx_t_10 < 0) {
16228  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16229  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16230  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16231  if (__pyx_t_11 < 0) {
16232  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16233  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16234  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16235  if (unlikely(__pyx_t_9 != -1)) {
16236  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16237  __PYX_ERR(0, 748, __pyx_L1_error)
16238  }
16239  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16240  }
16241 
16242  /* "subsurfaceTransportFunctions.pyx":749
16243  * vol_e += dV[eN,k]
16244  * omega_e += dV[eN,k]*dm[eN,k]
16245  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
16246  * for I in range(df.shape[2]):
16247  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16248  */
16249  __pyx_t_4 = (__pyx_v_df->dimensions[1]);
16250  __pyx_t_5 = __pyx_t_4;
16251  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16252  __pyx_v_k = __pyx_t_6;
16253 
16254  /* "subsurfaceTransportFunctions.pyx":750
16255  * omega_e += dV[eN,k]*dm[eN,k]
16256  * for k in range(df.shape[1]):
16257  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
16258  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16259  *
16260  */
16261  __pyx_t_12 = (__pyx_v_df->dimensions[2]);
16262  __pyx_t_13 = __pyx_t_12;
16263  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_13; __pyx_t_9+=1) {
16264  __pyx_v_I = __pyx_t_9;
16265 
16266  /* "subsurfaceTransportFunctions.pyx":751
16267  * for k in range(df.shape[1]):
16268  * for I in range(df.shape[2]):
16269  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16270  *
16271  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
16272  */
16273  __pyx_t_11 = __pyx_v_eN;
16274  __pyx_t_10 = __pyx_v_k;
16275  __pyx_t_7 = __pyx_v_I;
16276  __pyx_t_14 = -1;
16277  if (__pyx_t_11 < 0) {
16278  __pyx_t_11 += __pyx_pybuffernd_df.diminfo[0].shape;
16279  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 0;
16280  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_14 = 0;
16281  if (__pyx_t_10 < 0) {
16282  __pyx_t_10 += __pyx_pybuffernd_df.diminfo[1].shape;
16283  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 1;
16284  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_14 = 1;
16285  if (__pyx_t_7 < 0) {
16286  __pyx_t_7 += __pyx_pybuffernd_df.diminfo[2].shape;
16287  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 2;
16288  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_14 = 2;
16289  if (unlikely(__pyx_t_14 != -1)) {
16290  __Pyx_RaiseBufferIndexError(__pyx_t_14);
16291  __PYX_ERR(0, 751, __pyx_L1_error)
16292  }
16293  __pyx_t_15 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
16294  __pyx_t_16 = (__pyx_v_omega_e + 1.0e-12);
16295  if (unlikely(__pyx_t_16 == 0)) {
16296  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16297  __PYX_ERR(0, 751, __pyx_L1_error)
16298  }
16299  __pyx_t_7 = __pyx_v_eN;
16300  __pyx_t_10 = __pyx_v_k;
16301  __pyx_t_11 = __pyx_v_I;
16302  __pyx_t_14 = -1;
16303  if (__pyx_t_7 < 0) {
16304  __pyx_t_7 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
16305  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 0;
16306  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_14 = 0;
16307  if (__pyx_t_10 < 0) {
16308  __pyx_t_10 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
16309  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 1;
16310  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_14 = 1;
16311  if (__pyx_t_11 < 0) {
16312  __pyx_t_11 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
16313  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 2;
16314  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_14 = 2;
16315  if (unlikely(__pyx_t_14 != -1)) {
16316  __Pyx_RaiseBufferIndexError(__pyx_t_14);
16317  __PYX_ERR(0, 751, __pyx_L1_error)
16318  }
16319  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_15 / __pyx_t_16);
16320  }
16321  }
16322  }
16323 
16324  /* "subsurfaceTransportFunctions.pyx":732
16325  * flux[eN,ebN] = integral
16326  *
16327  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16328  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16329  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16330  */
16331 
16332  /* function exit code */
16333  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16334  goto __pyx_L0;
16335  __pyx_L1_error:;
16336  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16337  __Pyx_PyThreadState_declare
16338  __Pyx_PyThreadState_assign
16339  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16340  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16341  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16342  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16343  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16344  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16345  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16346  __pyx_r = NULL;
16347  goto __pyx_L2;
16348  __pyx_L0:;
16349  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16350  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16351  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16352  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16353  __pyx_L2:;
16354  __Pyx_XGIVEREF(__pyx_r);
16355  __Pyx_RefNannyFinishContext();
16356  return __pyx_r;
16357 }
16358 
16359 /* "subsurfaceTransportFunctions.pyx":753
16360  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16361  *
16362  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16363  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16364  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16365  */
16366 
16367 /* Python wrapper */
16368 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16369 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16370 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
16371 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16372  PyArrayObject *__pyx_v_df_dofs = 0;
16373  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
16374  PyArrayObject *__pyx_v_l2g = 0;
16375  PyArrayObject *__pyx_v_dm = 0;
16376  PyArrayObject *__pyx_v_dV = 0;
16377  int __pyx_lineno = 0;
16378  const char *__pyx_filename = NULL;
16379  int __pyx_clineno = 0;
16380  PyObject *__pyx_r = 0;
16381  __Pyx_RefNannyDeclarations
16382  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
16383  {
16384  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16385  PyObject* values[5] = {0,0,0,0,0};
16386  if (unlikely(__pyx_kwds)) {
16387  Py_ssize_t kw_args;
16388  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16389  switch (pos_args) {
16390  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16391  CYTHON_FALLTHROUGH;
16392  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16393  CYTHON_FALLTHROUGH;
16394  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16395  CYTHON_FALLTHROUGH;
16396  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16397  CYTHON_FALLTHROUGH;
16398  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16399  CYTHON_FALLTHROUGH;
16400  case 0: break;
16401  default: goto __pyx_L5_argtuple_error;
16402  }
16403  kw_args = PyDict_Size(__pyx_kwds);
16404  switch (pos_args) {
16405  case 0:
16406  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
16407  else goto __pyx_L5_argtuple_error;
16408  CYTHON_FALLTHROUGH;
16409  case 1:
16410  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
16411  else {
16412  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); __PYX_ERR(0, 753, __pyx_L3_error)
16413  }
16414  CYTHON_FALLTHROUGH;
16415  case 2:
16416  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
16417  else {
16418  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); __PYX_ERR(0, 753, __pyx_L3_error)
16419  }
16420  CYTHON_FALLTHROUGH;
16421  case 3:
16422  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16423  else {
16424  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); __PYX_ERR(0, 753, __pyx_L3_error)
16425  }
16426  CYTHON_FALLTHROUGH;
16427  case 4:
16428  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16429  else {
16430  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); __PYX_ERR(0, 753, __pyx_L3_error)
16431  }
16432  }
16433  if (unlikely(kw_args > 0)) {
16434  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) __PYX_ERR(0, 753, __pyx_L3_error)
16435  }
16436  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
16437  goto __pyx_L5_argtuple_error;
16438  } else {
16439  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16440  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16441  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16442  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16443  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16444  }
16445  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
16446  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
16447  __pyx_v_l2g = ((PyArrayObject *)values[2]);
16448  __pyx_v_dm = ((PyArrayObject *)values[3]);
16449  __pyx_v_dV = ((PyArrayObject *)values[4]);
16450  }
16451  goto __pyx_L4_argument_unpacking_done;
16452  __pyx_L5_argtuple_error:;
16453  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error)
16454  __pyx_L3_error:;
16455  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16456  __Pyx_RefNannyFinishContext();
16457  return NULL;
16458  __pyx_L4_argument_unpacking_done:;
16459  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) __PYX_ERR(0, 753, __pyx_L1_error)
16460  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) __PYX_ERR(0, 754, __pyx_L1_error)
16461  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) __PYX_ERR(0, 755, __pyx_L1_error)
16462  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 756, __pyx_L1_error)
16463  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 757, __pyx_L1_error)
16464  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
16465 
16466  /* function exit code */
16467  goto __pyx_L0;
16468  __pyx_L1_error:;
16469  __pyx_r = NULL;
16470  __pyx_L0:;
16471  __Pyx_RefNannyFinishContext();
16472  return __pyx_r;
16473 }
16474 
16475 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16476  int __pyx_v_eN;
16477  int __pyx_v_k;
16478  int __pyx_v_j;
16479  int __pyx_v_J;
16480  double __pyx_v_omega_e;
16481  double __pyx_v_vol_e;
16482  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
16483  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
16484  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16485  __Pyx_Buffer __pyx_pybuffer_dV;
16486  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
16487  __Pyx_Buffer __pyx_pybuffer_df_dofs;
16488  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16489  __Pyx_Buffer __pyx_pybuffer_dm;
16490  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
16491  __Pyx_Buffer __pyx_pybuffer_l2g;
16492  PyObject *__pyx_r = NULL;
16493  __Pyx_RefNannyDeclarations
16494  npy_intp __pyx_t_1;
16495  npy_intp __pyx_t_2;
16496  int __pyx_t_3;
16497  npy_intp __pyx_t_4;
16498  npy_intp __pyx_t_5;
16499  int __pyx_t_6;
16500  Py_ssize_t __pyx_t_7;
16501  Py_ssize_t __pyx_t_8;
16502  int __pyx_t_9;
16503  Py_ssize_t __pyx_t_10;
16504  Py_ssize_t __pyx_t_11;
16505  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_12;
16506  double __pyx_t_13;
16507  int __pyx_lineno = 0;
16508  const char *__pyx_filename = NULL;
16509  int __pyx_clineno = 0;
16510  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
16511  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
16512  __pyx_pybuffer_df_dofs.refcount = 0;
16513  __pyx_pybuffernd_df_dofs.data = NULL;
16514  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
16515  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
16516  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
16517  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
16518  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
16519  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
16520  __pyx_pybuffer_l2g.refcount = 0;
16521  __pyx_pybuffernd_l2g.data = NULL;
16522  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
16523  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16524  __pyx_pybuffer_dm.refcount = 0;
16525  __pyx_pybuffernd_dm.data = NULL;
16526  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16527  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16528  __pyx_pybuffer_dV.refcount = 0;
16529  __pyx_pybuffernd_dV.data = NULL;
16530  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16531  {
16532  __Pyx_BufFmt_StackElem __pyx_stack[1];
16533  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16534  }
16535  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
16536  {
16537  __Pyx_BufFmt_StackElem __pyx_stack[1];
16538  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16539  }
16540  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
16541  {
16542  __Pyx_BufFmt_StackElem __pyx_stack[1];
16543  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16544  }
16545  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
16546  {
16547  __Pyx_BufFmt_StackElem __pyx_stack[1];
16548  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16549  }
16550  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16551  {
16552  __Pyx_BufFmt_StackElem __pyx_stack[1];
16553  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16554  }
16555  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16556 
16557  /* "subsurfaceTransportFunctions.pyx":765
16558  * cdef double omega_e, vol_e
16559  *
16560  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16561  * omega_e = 0.0
16562  * vol_e = 0.0
16563  */
16564  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16565  __pyx_t_2 = __pyx_t_1;
16566  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16567  __pyx_v_eN = __pyx_t_3;
16568 
16569  /* "subsurfaceTransportFunctions.pyx":766
16570  *
16571  * for eN in range(dm.shape[0]):
16572  * omega_e = 0.0 # <<<<<<<<<<<<<<
16573  * vol_e = 0.0
16574  * for k in range(dm.shape[1]):
16575  */
16576  __pyx_v_omega_e = 0.0;
16577 
16578  /* "subsurfaceTransportFunctions.pyx":767
16579  * for eN in range(dm.shape[0]):
16580  * omega_e = 0.0
16581  * vol_e = 0.0 # <<<<<<<<<<<<<<
16582  * for k in range(dm.shape[1]):
16583  * vol_e += dV[eN,k]
16584  */
16585  __pyx_v_vol_e = 0.0;
16586 
16587  /* "subsurfaceTransportFunctions.pyx":768
16588  * omega_e = 0.0
16589  * vol_e = 0.0
16590  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16591  * vol_e += dV[eN,k]
16592  * omega_e += dV[eN,k]*dm[eN,k]
16593  */
16594  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16595  __pyx_t_5 = __pyx_t_4;
16596  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16597  __pyx_v_k = __pyx_t_6;
16598 
16599  /* "subsurfaceTransportFunctions.pyx":769
16600  * vol_e = 0.0
16601  * for k in range(dm.shape[1]):
16602  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16603  * omega_e += dV[eN,k]*dm[eN,k]
16604  * for j in range(l2g.shape[1]):
16605  */
16606  __pyx_t_7 = __pyx_v_eN;
16607  __pyx_t_8 = __pyx_v_k;
16608  __pyx_t_9 = -1;
16609  if (__pyx_t_7 < 0) {
16610  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16611  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16612  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16613  if (__pyx_t_8 < 0) {
16614  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16615  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16616  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16617  if (unlikely(__pyx_t_9 != -1)) {
16618  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16619  __PYX_ERR(0, 769, __pyx_L1_error)
16620  }
16621  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16622 
16623  /* "subsurfaceTransportFunctions.pyx":770
16624  * for k in range(dm.shape[1]):
16625  * vol_e += dV[eN,k]
16626  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16627  * for j in range(l2g.shape[1]):
16628  * J = l2g[eN,j]
16629  */
16630  __pyx_t_8 = __pyx_v_eN;
16631  __pyx_t_7 = __pyx_v_k;
16632  __pyx_t_9 = -1;
16633  if (__pyx_t_8 < 0) {
16634  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16635  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
16636  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16637  if (__pyx_t_7 < 0) {
16638  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
16639  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16640  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16641  if (unlikely(__pyx_t_9 != -1)) {
16642  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16643  __PYX_ERR(0, 770, __pyx_L1_error)
16644  }
16645  __pyx_t_10 = __pyx_v_eN;
16646  __pyx_t_11 = __pyx_v_k;
16647  __pyx_t_9 = -1;
16648  if (__pyx_t_10 < 0) {
16649  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16650  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16651  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16652  if (__pyx_t_11 < 0) {
16653  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16654  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16655  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16656  if (unlikely(__pyx_t_9 != -1)) {
16657  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16658  __PYX_ERR(0, 770, __pyx_L1_error)
16659  }
16660  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16661  }
16662 
16663  /* "subsurfaceTransportFunctions.pyx":771
16664  * vol_e += dV[eN,k]
16665  * omega_e += dV[eN,k]*dm[eN,k]
16666  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
16667  * J = l2g[eN,j]
16668  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16669  */
16670  __pyx_t_4 = (__pyx_v_l2g->dimensions[1]);
16671  __pyx_t_5 = __pyx_t_4;
16672  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16673  __pyx_v_j = __pyx_t_6;
16674 
16675  /* "subsurfaceTransportFunctions.pyx":772
16676  * omega_e += dV[eN,k]*dm[eN,k]
16677  * for j in range(l2g.shape[1]):
16678  * J = l2g[eN,j] # <<<<<<<<<<<<<<
16679  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16680  *
16681  */
16682  __pyx_t_11 = __pyx_v_eN;
16683  __pyx_t_10 = __pyx_v_j;
16684  __pyx_t_9 = -1;
16685  if (__pyx_t_11 < 0) {
16686  __pyx_t_11 += __pyx_pybuffernd_l2g.diminfo[0].shape;
16687  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
16688  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_9 = 0;
16689  if (__pyx_t_10 < 0) {
16690  __pyx_t_10 += __pyx_pybuffernd_l2g.diminfo[1].shape;
16691  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 1;
16692  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_9 = 1;
16693  if (unlikely(__pyx_t_9 != -1)) {
16694  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16695  __PYX_ERR(0, 772, __pyx_L1_error)
16696  }
16697  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_l2g.diminfo[1].strides));
16698 
16699  /* "subsurfaceTransportFunctions.pyx":773
16700  * for j in range(l2g.shape[1]):
16701  * J = l2g[eN,j]
16702  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16703  *
16704  * #problem specific velocity evaluation
16705  */
16706  __pyx_t_10 = __pyx_v_J;
16707  __pyx_t_9 = -1;
16708  if (__pyx_t_10 < 0) {
16709  __pyx_t_10 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
16710  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16711  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16712  if (unlikely(__pyx_t_9 != -1)) {
16713  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16714  __PYX_ERR(0, 773, __pyx_L1_error)
16715  }
16716  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
16717  __pyx_t_13 = (__pyx_v_omega_e + 1.0e-12);
16718  if (unlikely(__pyx_t_13 == 0)) {
16719  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16720  __PYX_ERR(0, 773, __pyx_L1_error)
16721  }
16722  __pyx_t_10 = __pyx_v_J;
16723  __pyx_t_9 = -1;
16724  if (__pyx_t_10 < 0) {
16725  __pyx_t_10 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
16726  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16727  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16728  if (unlikely(__pyx_t_9 != -1)) {
16729  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16730  __PYX_ERR(0, 773, __pyx_L1_error)
16731  }
16732  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_12 / __pyx_t_13);
16733  }
16734  }
16735 
16736  /* "subsurfaceTransportFunctions.pyx":753
16737  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16738  *
16739  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16740  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16741  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16742  */
16743 
16744  /* function exit code */
16745  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16746  goto __pyx_L0;
16747  __pyx_L1_error:;
16748  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16749  __Pyx_PyThreadState_declare
16750  __Pyx_PyThreadState_assign
16751  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16752  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16753  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16754  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16755  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16756  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16757  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16758  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16759  __pyx_r = NULL;
16760  goto __pyx_L2;
16761  __pyx_L0:;
16762  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16763  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16764  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16765  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16766  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16767  __pyx_L2:;
16768  __Pyx_XGIVEREF(__pyx_r);
16769  __Pyx_RefNannyFinishContext();
16770  return __pyx_r;
16771 }
16772 
16773 /* "subsurfaceTransportFunctions.pyx":776
16774  *
16775  * #problem specific velocity evaluation
16776  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16777  * double t,
16778  * double tForReversal,
16779  */
16780 
16781 /* Python wrapper */
16782 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16783 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
16784 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16785  int __pyx_v_transient;
16786  double __pyx_v_t;
16787  double __pyx_v_tForReversal;
16788  double __pyx_v_clock;
16789  double __pyx_v_xc;
16790  double __pyx_v_yc;
16791  PyArrayObject *__pyx_v_x = 0;
16792  PyArrayObject *__pyx_v_v = 0;
16793  double __pyx_v_zvelocity;
16794  int __pyx_lineno = 0;
16795  const char *__pyx_filename = NULL;
16796  int __pyx_clineno = 0;
16797  PyObject *__pyx_r = 0;
16798  __Pyx_RefNannyDeclarations
16799  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
16800  {
16801  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16802  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16803  if (unlikely(__pyx_kwds)) {
16804  Py_ssize_t kw_args;
16805  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16806  switch (pos_args) {
16807  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16808  CYTHON_FALLTHROUGH;
16809  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16810  CYTHON_FALLTHROUGH;
16811  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16812  CYTHON_FALLTHROUGH;
16813  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16814  CYTHON_FALLTHROUGH;
16815  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16816  CYTHON_FALLTHROUGH;
16817  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16818  CYTHON_FALLTHROUGH;
16819  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16820  CYTHON_FALLTHROUGH;
16821  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16822  CYTHON_FALLTHROUGH;
16823  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16824  CYTHON_FALLTHROUGH;
16825  case 0: break;
16826  default: goto __pyx_L5_argtuple_error;
16827  }
16828  kw_args = PyDict_Size(__pyx_kwds);
16829  switch (pos_args) {
16830  case 0:
16831  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16832  else goto __pyx_L5_argtuple_error;
16833  CYTHON_FALLTHROUGH;
16834  case 1:
16835  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16836  else {
16837  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); __PYX_ERR(0, 776, __pyx_L3_error)
16838  }
16839  CYTHON_FALLTHROUGH;
16840  case 2:
16841  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16842  else {
16843  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); __PYX_ERR(0, 776, __pyx_L3_error)
16844  }
16845  CYTHON_FALLTHROUGH;
16846  case 3:
16847  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16848  else {
16849  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); __PYX_ERR(0, 776, __pyx_L3_error)
16850  }
16851  CYTHON_FALLTHROUGH;
16852  case 4:
16853  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16854  else {
16855  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); __PYX_ERR(0, 776, __pyx_L3_error)
16856  }
16857  CYTHON_FALLTHROUGH;
16858  case 5:
16859  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16860  else {
16861  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); __PYX_ERR(0, 776, __pyx_L3_error)
16862  }
16863  CYTHON_FALLTHROUGH;
16864  case 6:
16865  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16866  else {
16867  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); __PYX_ERR(0, 776, __pyx_L3_error)
16868  }
16869  CYTHON_FALLTHROUGH;
16870  case 7:
16871  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16872  else {
16873  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); __PYX_ERR(0, 776, __pyx_L3_error)
16874  }
16875  CYTHON_FALLTHROUGH;
16876  case 8:
16877  if (kw_args > 0) {
16878  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
16879  if (value) { values[8] = value; kw_args--; }
16880  }
16881  }
16882  if (unlikely(kw_args > 0)) {
16883  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
16884  }
16885  } else {
16886  switch (PyTuple_GET_SIZE(__pyx_args)) {
16887  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16888  CYTHON_FALLTHROUGH;
16889  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16890  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16891  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16892  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16893  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16894  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16895  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16896  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16897  break;
16898  default: goto __pyx_L5_argtuple_error;
16899  }
16900  }
16901  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error)
16902  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L3_error)
16903  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L3_error)
16904  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L3_error)
16905  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16906  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16907  __pyx_v_x = ((PyArrayObject *)values[6]);
16908  __pyx_v_v = ((PyArrayObject *)values[7]);
16909  if (values[8]) {
16910  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
16911  } else {
16912  __pyx_v_zvelocity = ((double)0.0);
16913  }
16914  }
16915  goto __pyx_L4_argument_unpacking_done;
16916  __pyx_L5_argtuple_error:;
16917  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
16918  __pyx_L3_error:;
16919  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
16920  __Pyx_RefNannyFinishContext();
16921  return NULL;
16922  __pyx_L4_argument_unpacking_done:;
16923  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
16924  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 782, __pyx_L1_error)
16925  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
16926 
16927  /* function exit code */
16928  goto __pyx_L0;
16929  __pyx_L1_error:;
16930  __pyx_r = NULL;
16931  __pyx_L0:;
16932  __Pyx_RefNannyFinishContext();
16933  return __pyx_r;
16934 }
16935 
16936 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
16937  int __pyx_v_eN;
16938  int __pyx_v_k;
16939  double __pyx_v_pi;
16940  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
16941  __Pyx_Buffer __pyx_pybuffer_v;
16942  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
16943  __Pyx_Buffer __pyx_pybuffer_x;
16944  PyObject *__pyx_r = NULL;
16945  __Pyx_RefNannyDeclarations
16946  int __pyx_t_1;
16947  npy_intp __pyx_t_2;
16948  npy_intp __pyx_t_3;
16949  int __pyx_t_4;
16950  npy_intp __pyx_t_5;
16951  npy_intp __pyx_t_6;
16952  int __pyx_t_7;
16953  Py_ssize_t __pyx_t_8;
16954  Py_ssize_t __pyx_t_9;
16955  Py_ssize_t __pyx_t_10;
16956  int __pyx_t_11;
16957  Py_ssize_t __pyx_t_12;
16958  Py_ssize_t __pyx_t_13;
16959  Py_ssize_t __pyx_t_14;
16960  PyObject *__pyx_t_15 = NULL;
16961  PyObject *__pyx_t_16 = NULL;
16962  PyObject *__pyx_t_17 = NULL;
16963  double __pyx_t_18;
16964  double __pyx_t_19;
16965  PyObject *__pyx_t_20 = NULL;
16966  int __pyx_lineno = 0;
16967  const char *__pyx_filename = NULL;
16968  int __pyx_clineno = 0;
16969  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
16970  __pyx_pybuffer_x.pybuffer.buf = NULL;
16971  __pyx_pybuffer_x.refcount = 0;
16972  __pyx_pybuffernd_x.data = NULL;
16973  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
16974  __pyx_pybuffer_v.pybuffer.buf = NULL;
16975  __pyx_pybuffer_v.refcount = 0;
16976  __pyx_pybuffernd_v.data = NULL;
16977  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
16978  {
16979  __Pyx_BufFmt_StackElem __pyx_stack[1];
16980  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
16981  }
16982  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
16983  {
16984  __Pyx_BufFmt_StackElem __pyx_stack[1];
16985  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
16986  }
16987  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
16988 
16989  /* "subsurfaceTransportFunctions.pyx":786
16990  * cdef int eN,k
16991  * cdef double pi
16992  * pi = M_PI # <<<<<<<<<<<<<<
16993  * if v.shape[2] == 3:
16994  * if transient == 1:
16995  */
16996  __pyx_v_pi = M_PI;
16997 
16998  /* "subsurfaceTransportFunctions.pyx":787
16999  * cdef double pi
17000  * pi = M_PI
17001  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17002  * if transient == 1:
17003  * for eN in range(x.shape[0]):
17004  */
17005  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
17006  if (__pyx_t_1) {
17007 
17008  /* "subsurfaceTransportFunctions.pyx":788
17009  * pi = M_PI
17010  * if v.shape[2] == 3:
17011  * if transient == 1: # <<<<<<<<<<<<<<
17012  * for eN in range(x.shape[0]):
17013  * for k in range(x.shape[1]):
17014  */
17015  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17016  if (__pyx_t_1) {
17017 
17018  /* "subsurfaceTransportFunctions.pyx":789
17019  * if v.shape[2] == 3:
17020  * if transient == 1:
17021  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17022  * for k in range(x.shape[1]):
17023  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17024  */
17025  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17026  __pyx_t_3 = __pyx_t_2;
17027  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17028  __pyx_v_eN = __pyx_t_4;
17029 
17030  /* "subsurfaceTransportFunctions.pyx":790
17031  * if transient == 1:
17032  * for eN in range(x.shape[0]):
17033  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17034  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17035  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17036  */
17037  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17038  __pyx_t_6 = __pyx_t_5;
17039  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17040  __pyx_v_k = __pyx_t_7;
17041 
17042  /* "subsurfaceTransportFunctions.pyx":791
17043  * for eN in range(x.shape[0]):
17044  * for k in range(x.shape[1]):
17045  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17046  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17047  * v[eN,k,2]=zvelocity
17048  */
17049  __pyx_t_8 = __pyx_v_eN;
17050  __pyx_t_9 = __pyx_v_k;
17051  __pyx_t_10 = 1;
17052  __pyx_t_11 = -1;
17053  if (__pyx_t_8 < 0) {
17054  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17055  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17056  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17057  if (__pyx_t_9 < 0) {
17058  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17059  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17060  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17061  if (__pyx_t_10 < 0) {
17062  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17063  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17064  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17065  if (unlikely(__pyx_t_11 != -1)) {
17066  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17067  __PYX_ERR(0, 791, __pyx_L1_error)
17068  }
17069  __pyx_t_12 = __pyx_v_eN;
17070  __pyx_t_13 = __pyx_v_k;
17071  __pyx_t_14 = 0;
17072  __pyx_t_11 = -1;
17073  if (__pyx_t_12 < 0) {
17074  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17075  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17076  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17077  if (__pyx_t_13 < 0) {
17078  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17079  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17080  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17081  if (__pyx_t_14 < 0) {
17082  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17083  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17084  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17085  if (unlikely(__pyx_t_11 != -1)) {
17086  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17087  __PYX_ERR(0, 791, __pyx_L1_error)
17088  }
17089  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17090 
17091  /* "subsurfaceTransportFunctions.pyx":792
17092  * for k in range(x.shape[1]):
17093  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17094  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17095  * v[eN,k,2]=zvelocity
17096  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17097  */
17098  __pyx_t_10 = __pyx_v_eN;
17099  __pyx_t_9 = __pyx_v_k;
17100  __pyx_t_8 = 0;
17101  __pyx_t_11 = -1;
17102  if (__pyx_t_10 < 0) {
17103  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17104  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17105  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17106  if (__pyx_t_9 < 0) {
17107  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17108  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17109  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17110  if (__pyx_t_8 < 0) {
17111  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17112  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17113  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17114  if (unlikely(__pyx_t_11 != -1)) {
17115  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17116  __PYX_ERR(0, 792, __pyx_L1_error)
17117  }
17118  __pyx_t_14 = __pyx_v_eN;
17119  __pyx_t_13 = __pyx_v_k;
17120  __pyx_t_12 = 1;
17121  __pyx_t_11 = -1;
17122  if (__pyx_t_14 < 0) {
17123  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17124  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17125  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17126  if (__pyx_t_13 < 0) {
17127  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17128  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17129  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17130  if (__pyx_t_12 < 0) {
17131  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17132  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17133  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17134  if (unlikely(__pyx_t_11 != -1)) {
17135  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17136  __PYX_ERR(0, 792, __pyx_L1_error)
17137  }
17138  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17139 
17140  /* "subsurfaceTransportFunctions.pyx":793
17141  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17142  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17143  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17144  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17145  * else:
17146  */
17147  __pyx_t_8 = __pyx_v_eN;
17148  __pyx_t_9 = __pyx_v_k;
17149  __pyx_t_10 = 2;
17150  __pyx_t_11 = -1;
17151  if (__pyx_t_8 < 0) {
17152  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[0].shape;
17153  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17154  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17155  if (__pyx_t_9 < 0) {
17156  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
17157  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17158  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17159  if (__pyx_t_10 < 0) {
17160  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[2].shape;
17161  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17162  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17163  if (unlikely(__pyx_t_11 != -1)) {
17164  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17165  __PYX_ERR(0, 793, __pyx_L1_error)
17166  }
17167  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17168 
17169  /* "subsurfaceTransportFunctions.pyx":794
17170  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17171  * v[eN,k,2]=zvelocity
17172  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17173  * else:
17174  * for eN in range(x.shape[0]):
17175  */
17176  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L1_error)
17177  __Pyx_GOTREF(__pyx_t_15);
17178  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 794, __pyx_L1_error)
17179  __Pyx_GOTREF(__pyx_t_16);
17180  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 794, __pyx_L1_error)
17181  __Pyx_GOTREF(__pyx_t_17);
17182  __Pyx_GIVEREF(__pyx_t_15);
17183  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
17184  __Pyx_GIVEREF(__pyx_t_16);
17185  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
17186  __Pyx_INCREF(__pyx_slice_);
17187  __Pyx_GIVEREF(__pyx_slice_);
17188  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_slice_);
17189  __pyx_t_15 = 0;
17190  __pyx_t_16 = 0;
17191  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 794, __pyx_L1_error)
17192  __Pyx_GOTREF(__pyx_t_16);
17193  __pyx_t_18 = (__pyx_v_tForReversal - __pyx_v_t);
17194  __pyx_t_19 = (__pyx_v_tForReversal - 0.0);
17195  if (unlikely(__pyx_t_19 == 0)) {
17196  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17197  __PYX_ERR(0, 794, __pyx_L1_error)
17198  }
17199  __pyx_t_15 = PyFloat_FromDouble(((__pyx_t_18 / __pyx_t_19) * __pyx_v_clock)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L1_error)
17200  __Pyx_GOTREF(__pyx_t_15);
17201  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 794, __pyx_L1_error)
17202  __Pyx_GOTREF(__pyx_t_20);
17203  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17204  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17205  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_17, __pyx_t_20) < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
17206  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
17207  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17208  }
17209  }
17210 
17211  /* "subsurfaceTransportFunctions.pyx":788
17212  * pi = M_PI
17213  * if v.shape[2] == 3:
17214  * if transient == 1: # <<<<<<<<<<<<<<
17215  * for eN in range(x.shape[0]):
17216  * for k in range(x.shape[1]):
17217  */
17218  goto __pyx_L4;
17219  }
17220 
17221  /* "subsurfaceTransportFunctions.pyx":796
17222  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17223  * else:
17224  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17225  * for k in range(x.shape[1]):
17226  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17227  */
17228  /*else*/ {
17229  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17230  __pyx_t_3 = __pyx_t_2;
17231  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17232  __pyx_v_eN = __pyx_t_4;
17233 
17234  /* "subsurfaceTransportFunctions.pyx":797
17235  * else:
17236  * for eN in range(x.shape[0]):
17237  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17238  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17239  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17240  */
17241  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17242  __pyx_t_6 = __pyx_t_5;
17243  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17244  __pyx_v_k = __pyx_t_7;
17245 
17246  /* "subsurfaceTransportFunctions.pyx":798
17247  * for eN in range(x.shape[0]):
17248  * for k in range(x.shape[1]):
17249  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17250  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17251  * v[eN,k,2]=zvelocity
17252  */
17253  __pyx_t_10 = __pyx_v_eN;
17254  __pyx_t_9 = __pyx_v_k;
17255  __pyx_t_8 = 1;
17256  __pyx_t_11 = -1;
17257  if (__pyx_t_10 < 0) {
17258  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17259  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17260  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17261  if (__pyx_t_9 < 0) {
17262  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17263  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17264  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17265  if (__pyx_t_8 < 0) {
17266  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17267  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17268  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17269  if (unlikely(__pyx_t_11 != -1)) {
17270  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17271  __PYX_ERR(0, 798, __pyx_L1_error)
17272  }
17273  __pyx_t_12 = __pyx_v_eN;
17274  __pyx_t_13 = __pyx_v_k;
17275  __pyx_t_14 = 0;
17276  __pyx_t_11 = -1;
17277  if (__pyx_t_12 < 0) {
17278  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17279  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17280  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17281  if (__pyx_t_13 < 0) {
17282  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17283  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17284  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17285  if (__pyx_t_14 < 0) {
17286  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17287  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17288  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17289  if (unlikely(__pyx_t_11 != -1)) {
17290  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17291  __PYX_ERR(0, 798, __pyx_L1_error)
17292  }
17293  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17294 
17295  /* "subsurfaceTransportFunctions.pyx":799
17296  * for k in range(x.shape[1]):
17297  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17298  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17299  * v[eN,k,2]=zvelocity
17300  * else:
17301  */
17302  __pyx_t_8 = __pyx_v_eN;
17303  __pyx_t_9 = __pyx_v_k;
17304  __pyx_t_10 = 0;
17305  __pyx_t_11 = -1;
17306  if (__pyx_t_8 < 0) {
17307  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17308  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17309  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17310  if (__pyx_t_9 < 0) {
17311  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17312  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17313  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17314  if (__pyx_t_10 < 0) {
17315  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17316  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17317  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17318  if (unlikely(__pyx_t_11 != -1)) {
17319  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17320  __PYX_ERR(0, 799, __pyx_L1_error)
17321  }
17322  __pyx_t_14 = __pyx_v_eN;
17323  __pyx_t_13 = __pyx_v_k;
17324  __pyx_t_12 = 1;
17325  __pyx_t_11 = -1;
17326  if (__pyx_t_14 < 0) {
17327  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17328  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17329  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17330  if (__pyx_t_13 < 0) {
17331  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17332  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17333  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17334  if (__pyx_t_12 < 0) {
17335  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17336  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17337  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17338  if (unlikely(__pyx_t_11 != -1)) {
17339  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17340  __PYX_ERR(0, 799, __pyx_L1_error)
17341  }
17342  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides))));
17343 
17344  /* "subsurfaceTransportFunctions.pyx":800
17345  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17346  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17347  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17348  * else:
17349  * assert v.shape[2] == 2
17350  */
17351  __pyx_t_10 = __pyx_v_eN;
17352  __pyx_t_9 = __pyx_v_k;
17353  __pyx_t_8 = 2;
17354  __pyx_t_11 = -1;
17355  if (__pyx_t_10 < 0) {
17356  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
17357  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17358  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17359  if (__pyx_t_9 < 0) {
17360  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
17361  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17362  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17363  if (__pyx_t_8 < 0) {
17364  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[2].shape;
17365  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17366  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17367  if (unlikely(__pyx_t_11 != -1)) {
17368  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17369  __PYX_ERR(0, 800, __pyx_L1_error)
17370  }
17371  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17372  }
17373  }
17374  }
17375  __pyx_L4:;
17376 
17377  /* "subsurfaceTransportFunctions.pyx":787
17378  * cdef double pi
17379  * pi = M_PI
17380  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17381  * if transient == 1:
17382  * for eN in range(x.shape[0]):
17383  */
17384  goto __pyx_L3;
17385  }
17386 
17387  /* "subsurfaceTransportFunctions.pyx":802
17388  * v[eN,k,2]=zvelocity
17389  * else:
17390  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
17391  * if transient == 1:
17392  * for eN in range(x.shape[0]):
17393  */
17394  /*else*/ {
17395  #ifndef CYTHON_WITHOUT_ASSERTIONS
17396  if (unlikely(!Py_OptimizeFlag)) {
17397  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
17398  PyErr_SetNone(PyExc_AssertionError);
17399  __PYX_ERR(0, 802, __pyx_L1_error)
17400  }
17401  }
17402  #endif
17403 
17404  /* "subsurfaceTransportFunctions.pyx":803
17405  * else:
17406  * assert v.shape[2] == 2
17407  * if transient == 1: # <<<<<<<<<<<<<<
17408  * for eN in range(x.shape[0]):
17409  * for k in range(x.shape[1]):
17410  */
17411  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17412  if (__pyx_t_1) {
17413 
17414  /* "subsurfaceTransportFunctions.pyx":804
17415  * assert v.shape[2] == 2
17416  * if transient == 1:
17417  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17418  * for k in range(x.shape[1]):
17419  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17420  */
17421  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17422  __pyx_t_3 = __pyx_t_2;
17423  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17424  __pyx_v_eN = __pyx_t_4;
17425 
17426  /* "subsurfaceTransportFunctions.pyx":805
17427  * if transient == 1:
17428  * for eN in range(x.shape[0]):
17429  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17430  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17431  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17432  */
17433  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17434  __pyx_t_6 = __pyx_t_5;
17435  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17436  __pyx_v_k = __pyx_t_7;
17437 
17438  /* "subsurfaceTransportFunctions.pyx":806
17439  * for eN in range(x.shape[0]):
17440  * for k in range(x.shape[1]):
17441  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17442  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17443  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17444  */
17445  __pyx_t_8 = __pyx_v_eN;
17446  __pyx_t_9 = __pyx_v_k;
17447  __pyx_t_10 = 1;
17448  __pyx_t_11 = -1;
17449  if (__pyx_t_8 < 0) {
17450  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17451  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17452  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17453  if (__pyx_t_9 < 0) {
17454  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17455  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17456  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17457  if (__pyx_t_10 < 0) {
17458  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17459  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17460  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17461  if (unlikely(__pyx_t_11 != -1)) {
17462  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17463  __PYX_ERR(0, 806, __pyx_L1_error)
17464  }
17465  __pyx_t_12 = __pyx_v_eN;
17466  __pyx_t_13 = __pyx_v_k;
17467  __pyx_t_14 = 0;
17468  __pyx_t_11 = -1;
17469  if (__pyx_t_12 < 0) {
17470  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17471  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17472  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17473  if (__pyx_t_13 < 0) {
17474  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17475  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17476  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17477  if (__pyx_t_14 < 0) {
17478  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17479  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17480  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17481  if (unlikely(__pyx_t_11 != -1)) {
17482  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17483  __PYX_ERR(0, 806, __pyx_L1_error)
17484  }
17485  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17486 
17487  /* "subsurfaceTransportFunctions.pyx":807
17488  * for k in range(x.shape[1]):
17489  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17490  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17491  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17492  * else:
17493  */
17494  __pyx_t_10 = __pyx_v_eN;
17495  __pyx_t_9 = __pyx_v_k;
17496  __pyx_t_8 = 0;
17497  __pyx_t_11 = -1;
17498  if (__pyx_t_10 < 0) {
17499  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17500  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17501  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17502  if (__pyx_t_9 < 0) {
17503  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17504  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17505  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17506  if (__pyx_t_8 < 0) {
17507  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17508  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17509  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17510  if (unlikely(__pyx_t_11 != -1)) {
17511  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17512  __PYX_ERR(0, 807, __pyx_L1_error)
17513  }
17514  __pyx_t_14 = __pyx_v_eN;
17515  __pyx_t_13 = __pyx_v_k;
17516  __pyx_t_12 = 1;
17517  __pyx_t_11 = -1;
17518  if (__pyx_t_14 < 0) {
17519  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17520  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17521  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17522  if (__pyx_t_13 < 0) {
17523  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17524  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17525  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17526  if (__pyx_t_12 < 0) {
17527  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17528  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17529  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17530  if (unlikely(__pyx_t_11 != -1)) {
17531  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17532  __PYX_ERR(0, 807, __pyx_L1_error)
17533  }
17534  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17535 
17536  /* "subsurfaceTransportFunctions.pyx":808
17537  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17538  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17539  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17540  * else:
17541  * for eN in range(x.shape[0]):
17542  */
17543  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 808, __pyx_L1_error)
17544  __Pyx_GOTREF(__pyx_t_17);
17545  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 808, __pyx_L1_error)
17546  __Pyx_GOTREF(__pyx_t_20);
17547  __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 808, __pyx_L1_error)
17548  __Pyx_GOTREF(__pyx_t_15);
17549  __Pyx_GIVEREF(__pyx_t_17);
17550  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_17);
17551  __Pyx_GIVEREF(__pyx_t_20);
17552  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_20);
17553  __Pyx_INCREF(__pyx_slice_);
17554  __Pyx_GIVEREF(__pyx_slice_);
17555  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_slice_);
17556  __pyx_t_17 = 0;
17557  __pyx_t_20 = 0;
17558  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 808, __pyx_L1_error)
17559  __Pyx_GOTREF(__pyx_t_20);
17560  __pyx_t_19 = (__pyx_v_tForReversal - __pyx_v_t);
17561  __pyx_t_18 = (__pyx_v_tForReversal - 0.0);
17562  if (unlikely(__pyx_t_18 == 0)) {
17563  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17564  __PYX_ERR(0, 808, __pyx_L1_error)
17565  }
17566  __pyx_t_17 = PyFloat_FromDouble(((__pyx_t_19 / __pyx_t_18) * __pyx_v_clock)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 808, __pyx_L1_error)
17567  __Pyx_GOTREF(__pyx_t_17);
17568  __pyx_t_16 = PyNumber_InPlaceMultiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 808, __pyx_L1_error)
17569  __Pyx_GOTREF(__pyx_t_16);
17570  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
17571  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17572  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_15, __pyx_t_16) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
17573  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17574  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17575  }
17576  }
17577 
17578  /* "subsurfaceTransportFunctions.pyx":803
17579  * else:
17580  * assert v.shape[2] == 2
17581  * if transient == 1: # <<<<<<<<<<<<<<
17582  * for eN in range(x.shape[0]):
17583  * for k in range(x.shape[1]):
17584  */
17585  goto __pyx_L13;
17586  }
17587 
17588  /* "subsurfaceTransportFunctions.pyx":810
17589  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17590  * else:
17591  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17592  * for k in range(x.shape[1]):
17593  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17594  */
17595  /*else*/ {
17596  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17597  __pyx_t_3 = __pyx_t_2;
17598  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17599  __pyx_v_eN = __pyx_t_4;
17600 
17601  /* "subsurfaceTransportFunctions.pyx":811
17602  * else:
17603  * for eN in range(x.shape[0]):
17604  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17605  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17606  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17607  */
17608  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17609  __pyx_t_6 = __pyx_t_5;
17610  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17611  __pyx_v_k = __pyx_t_7;
17612 
17613  /* "subsurfaceTransportFunctions.pyx":812
17614  * for eN in range(x.shape[0]):
17615  * for k in range(x.shape[1]):
17616  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17617  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17618  *
17619  */
17620  __pyx_t_8 = __pyx_v_eN;
17621  __pyx_t_9 = __pyx_v_k;
17622  __pyx_t_10 = 1;
17623  __pyx_t_11 = -1;
17624  if (__pyx_t_8 < 0) {
17625  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17626  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17627  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17628  if (__pyx_t_9 < 0) {
17629  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17630  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17631  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17632  if (__pyx_t_10 < 0) {
17633  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17634  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17635  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17636  if (unlikely(__pyx_t_11 != -1)) {
17637  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17638  __PYX_ERR(0, 812, __pyx_L1_error)
17639  }
17640  __pyx_t_12 = __pyx_v_eN;
17641  __pyx_t_13 = __pyx_v_k;
17642  __pyx_t_14 = 0;
17643  __pyx_t_11 = -1;
17644  if (__pyx_t_12 < 0) {
17645  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17646  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17647  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17648  if (__pyx_t_13 < 0) {
17649  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17650  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17651  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17652  if (__pyx_t_14 < 0) {
17653  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17654  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17655  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17656  if (unlikely(__pyx_t_11 != -1)) {
17657  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17658  __PYX_ERR(0, 812, __pyx_L1_error)
17659  }
17660  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17661 
17662  /* "subsurfaceTransportFunctions.pyx":813
17663  * for k in range(x.shape[1]):
17664  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17665  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17666  *
17667  *
17668  */
17669  __pyx_t_10 = __pyx_v_eN;
17670  __pyx_t_9 = __pyx_v_k;
17671  __pyx_t_8 = 0;
17672  __pyx_t_11 = -1;
17673  if (__pyx_t_10 < 0) {
17674  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17675  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17676  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17677  if (__pyx_t_9 < 0) {
17678  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17679  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17680  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17681  if (__pyx_t_8 < 0) {
17682  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17683  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17684  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17685  if (unlikely(__pyx_t_11 != -1)) {
17686  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17687  __PYX_ERR(0, 813, __pyx_L1_error)
17688  }
17689  __pyx_t_14 = __pyx_v_eN;
17690  __pyx_t_13 = __pyx_v_k;
17691  __pyx_t_12 = 1;
17692  __pyx_t_11 = -1;
17693  if (__pyx_t_14 < 0) {
17694  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17695  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17696  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17697  if (__pyx_t_13 < 0) {
17698  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17699  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17700  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17701  if (__pyx_t_12 < 0) {
17702  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17703  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17704  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17705  if (unlikely(__pyx_t_11 != -1)) {
17706  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17707  __PYX_ERR(0, 813, __pyx_L1_error)
17708  }
17709  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17710  }
17711  }
17712  }
17713  __pyx_L13:;
17714  }
17715  __pyx_L3:;
17716 
17717  /* "subsurfaceTransportFunctions.pyx":776
17718  *
17719  * #problem specific velocity evaluation
17720  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17721  * double t,
17722  * double tForReversal,
17723  */
17724 
17725  /* function exit code */
17726  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17727  goto __pyx_L0;
17728  __pyx_L1_error:;
17729  __Pyx_XDECREF(__pyx_t_15);
17730  __Pyx_XDECREF(__pyx_t_16);
17731  __Pyx_XDECREF(__pyx_t_17);
17732  __Pyx_XDECREF(__pyx_t_20);
17733  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17734  __Pyx_PyThreadState_declare
17735  __Pyx_PyThreadState_assign
17736  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17737  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17738  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17739  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17740  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17741  __pyx_r = NULL;
17742  goto __pyx_L2;
17743  __pyx_L0:;
17744  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17745  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17746  __pyx_L2:;
17747  __Pyx_XGIVEREF(__pyx_r);
17748  __Pyx_RefNannyFinishContext();
17749  return __pyx_r;
17750 }
17751 
17752 /* "subsurfaceTransportFunctions.pyx":816
17753  *
17754  *
17755  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17756  * double t,
17757  * double tForReversal,
17758  */
17759 
17760 /* Python wrapper */
17761 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17762 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
17763 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17764  int __pyx_v_transient;
17765  double __pyx_v_t;
17766  double __pyx_v_tForReversal;
17767  double __pyx_v_clock;
17768  double __pyx_v_xc;
17769  double __pyx_v_yc;
17770  PyArrayObject *__pyx_v_x = 0;
17771  PyArrayObject *__pyx_v_v = 0;
17772  double __pyx_v_zvelocity;
17773  int __pyx_lineno = 0;
17774  const char *__pyx_filename = NULL;
17775  int __pyx_clineno = 0;
17776  PyObject *__pyx_r = 0;
17777  __Pyx_RefNannyDeclarations
17778  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
17779  {
17780  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
17781  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17782  if (unlikely(__pyx_kwds)) {
17783  Py_ssize_t kw_args;
17784  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17785  switch (pos_args) {
17786  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17787  CYTHON_FALLTHROUGH;
17788  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17789  CYTHON_FALLTHROUGH;
17790  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17791  CYTHON_FALLTHROUGH;
17792  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17793  CYTHON_FALLTHROUGH;
17794  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17795  CYTHON_FALLTHROUGH;
17796  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17797  CYTHON_FALLTHROUGH;
17798  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17799  CYTHON_FALLTHROUGH;
17800  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17801  CYTHON_FALLTHROUGH;
17802  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17803  CYTHON_FALLTHROUGH;
17804  case 0: break;
17805  default: goto __pyx_L5_argtuple_error;
17806  }
17807  kw_args = PyDict_Size(__pyx_kwds);
17808  switch (pos_args) {
17809  case 0:
17810  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17811  else goto __pyx_L5_argtuple_error;
17812  CYTHON_FALLTHROUGH;
17813  case 1:
17814  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17815  else {
17816  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); __PYX_ERR(0, 816, __pyx_L3_error)
17817  }
17818  CYTHON_FALLTHROUGH;
17819  case 2:
17820  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17821  else {
17822  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); __PYX_ERR(0, 816, __pyx_L3_error)
17823  }
17824  CYTHON_FALLTHROUGH;
17825  case 3:
17826  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17827  else {
17828  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); __PYX_ERR(0, 816, __pyx_L3_error)
17829  }
17830  CYTHON_FALLTHROUGH;
17831  case 4:
17832  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17833  else {
17834  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); __PYX_ERR(0, 816, __pyx_L3_error)
17835  }
17836  CYTHON_FALLTHROUGH;
17837  case 5:
17838  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17839  else {
17840  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); __PYX_ERR(0, 816, __pyx_L3_error)
17841  }
17842  CYTHON_FALLTHROUGH;
17843  case 6:
17844  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17845  else {
17846  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); __PYX_ERR(0, 816, __pyx_L3_error)
17847  }
17848  CYTHON_FALLTHROUGH;
17849  case 7:
17850  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17851  else {
17852  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); __PYX_ERR(0, 816, __pyx_L3_error)
17853  }
17854  CYTHON_FALLTHROUGH;
17855  case 8:
17856  if (kw_args > 0) {
17857  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
17858  if (value) { values[8] = value; kw_args--; }
17859  }
17860  }
17861  if (unlikely(kw_args > 0)) {
17862  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) __PYX_ERR(0, 816, __pyx_L3_error)
17863  }
17864  } else {
17865  switch (PyTuple_GET_SIZE(__pyx_args)) {
17866  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17867  CYTHON_FALLTHROUGH;
17868  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17869  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17870  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17871  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17872  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17873  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17874  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17875  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17876  break;
17877  default: goto __pyx_L5_argtuple_error;
17878  }
17879  }
17880  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L3_error)
17881  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
17882  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
17883  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L3_error)
17884  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17885  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17886  __pyx_v_x = ((PyArrayObject *)values[6]);
17887  __pyx_v_v = ((PyArrayObject *)values[7]);
17888  if (values[8]) {
17889  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error)
17890  } else {
17891  __pyx_v_zvelocity = ((double)0.0);
17892  }
17893  }
17894  goto __pyx_L4_argument_unpacking_done;
17895  __pyx_L5_argtuple_error:;
17896  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 816, __pyx_L3_error)
17897  __pyx_L3_error:;
17898  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
17899  __Pyx_RefNannyFinishContext();
17900  return NULL;
17901  __pyx_L4_argument_unpacking_done:;
17902  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 821, __pyx_L1_error)
17903  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
17904  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17905 
17906  /* function exit code */
17907  goto __pyx_L0;
17908  __pyx_L1_error:;
17909  __pyx_r = NULL;
17910  __pyx_L0:;
17911  __Pyx_RefNannyFinishContext();
17912  return __pyx_r;
17913 }
17914 
17915 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
17916  int __pyx_v_eN;
17917  int __pyx_v_ebN;
17918  int __pyx_v_k;
17919  double __pyx_v_pi;
17920  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
17921  __Pyx_Buffer __pyx_pybuffer_v;
17922  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
17923  __Pyx_Buffer __pyx_pybuffer_x;
17924  PyObject *__pyx_r = NULL;
17925  __Pyx_RefNannyDeclarations
17926  int __pyx_t_1;
17927  npy_intp __pyx_t_2;
17928  npy_intp __pyx_t_3;
17929  int __pyx_t_4;
17930  npy_intp __pyx_t_5;
17931  npy_intp __pyx_t_6;
17932  int __pyx_t_7;
17933  npy_intp __pyx_t_8;
17934  npy_intp __pyx_t_9;
17935  int __pyx_t_10;
17936  Py_ssize_t __pyx_t_11;
17937  Py_ssize_t __pyx_t_12;
17938  Py_ssize_t __pyx_t_13;
17939  Py_ssize_t __pyx_t_14;
17940  int __pyx_t_15;
17941  Py_ssize_t __pyx_t_16;
17942  Py_ssize_t __pyx_t_17;
17943  Py_ssize_t __pyx_t_18;
17944  Py_ssize_t __pyx_t_19;
17945  PyObject *__pyx_t_20 = NULL;
17946  PyObject *__pyx_t_21 = NULL;
17947  PyObject *__pyx_t_22 = NULL;
17948  PyObject *__pyx_t_23 = NULL;
17949  double __pyx_t_24;
17950  double __pyx_t_25;
17951  int __pyx_lineno = 0;
17952  const char *__pyx_filename = NULL;
17953  int __pyx_clineno = 0;
17954  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
17955  __pyx_pybuffer_x.pybuffer.buf = NULL;
17956  __pyx_pybuffer_x.refcount = 0;
17957  __pyx_pybuffernd_x.data = NULL;
17958  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17959  __pyx_pybuffer_v.pybuffer.buf = NULL;
17960  __pyx_pybuffer_v.refcount = 0;
17961  __pyx_pybuffernd_v.data = NULL;
17962  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17963  {
17964  __Pyx_BufFmt_StackElem __pyx_stack[1];
17965  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
17966  }
17967  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
17968  {
17969  __Pyx_BufFmt_StackElem __pyx_stack[1];
17970  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
17971  }
17972  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
17973 
17974  /* "subsurfaceTransportFunctions.pyx":826
17975  * cdef int eN,ebN,k
17976  * cdef double pi
17977  * pi = M_PI # <<<<<<<<<<<<<<
17978  * if v.shape[v.ndim-1] == 3:
17979  * if transient == 1:
17980  */
17981  __pyx_v_pi = M_PI;
17982 
17983  /* "subsurfaceTransportFunctions.pyx":827
17984  * cdef double pi
17985  * pi = M_PI
17986  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
17987  * if transient == 1:
17988  * for eN in range(x.shape[0]):
17989  */
17990  __pyx_t_1 = (((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 3) != 0);
17991  if (__pyx_t_1) {
17992 
17993  /* "subsurfaceTransportFunctions.pyx":828
17994  * pi = M_PI
17995  * if v.shape[v.ndim-1] == 3:
17996  * if transient == 1: # <<<<<<<<<<<<<<
17997  * for eN in range(x.shape[0]):
17998  * for ebN in range(x.shape[1]):
17999  */
18000  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18001  if (__pyx_t_1) {
18002 
18003  /* "subsurfaceTransportFunctions.pyx":829
18004  * if v.shape[v.ndim-1] == 3:
18005  * if transient == 1:
18006  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18007  * for ebN in range(x.shape[1]):
18008  * for k in range(x.shape[2]):
18009  */
18010  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18011  __pyx_t_3 = __pyx_t_2;
18012  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18013  __pyx_v_eN = __pyx_t_4;
18014 
18015  /* "subsurfaceTransportFunctions.pyx":830
18016  * if transient == 1:
18017  * for eN in range(x.shape[0]):
18018  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18019  * for k in range(x.shape[2]):
18020  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18021  */
18022  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18023  __pyx_t_6 = __pyx_t_5;
18024  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18025  __pyx_v_ebN = __pyx_t_7;
18026 
18027  /* "subsurfaceTransportFunctions.pyx":831
18028  * for eN in range(x.shape[0]):
18029  * for ebN in range(x.shape[1]):
18030  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18031  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18032  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18033  */
18034  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18035  __pyx_t_9 = __pyx_t_8;
18036  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18037  __pyx_v_k = __pyx_t_10;
18038 
18039  /* "subsurfaceTransportFunctions.pyx":832
18040  * for ebN in range(x.shape[1]):
18041  * for k in range(x.shape[2]):
18042  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18043  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18044  * v[eN,ebN,k,2]=zvelocity
18045  */
18046  __pyx_t_11 = __pyx_v_eN;
18047  __pyx_t_12 = __pyx_v_ebN;
18048  __pyx_t_13 = __pyx_v_k;
18049  __pyx_t_14 = 1;
18050  __pyx_t_15 = -1;
18051  if (__pyx_t_11 < 0) {
18052  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18053  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18054  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18055  if (__pyx_t_12 < 0) {
18056  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18057  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18058  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18059  if (__pyx_t_13 < 0) {
18060  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18061  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18062  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18063  if (__pyx_t_14 < 0) {
18064  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18065  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18066  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18067  if (unlikely(__pyx_t_15 != -1)) {
18068  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18069  __PYX_ERR(0, 832, __pyx_L1_error)
18070  }
18071  __pyx_t_16 = __pyx_v_eN;
18072  __pyx_t_17 = __pyx_v_ebN;
18073  __pyx_t_18 = __pyx_v_k;
18074  __pyx_t_19 = 0;
18075  __pyx_t_15 = -1;
18076  if (__pyx_t_16 < 0) {
18077  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18078  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18079  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18080  if (__pyx_t_17 < 0) {
18081  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18082  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18083  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18084  if (__pyx_t_18 < 0) {
18085  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18086  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18087  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18088  if (__pyx_t_19 < 0) {
18089  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18090  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18091  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18092  if (unlikely(__pyx_t_15 != -1)) {
18093  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18094  __PYX_ERR(0, 832, __pyx_L1_error)
18095  }
18096  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18097 
18098  /* "subsurfaceTransportFunctions.pyx":833
18099  * for k in range(x.shape[2]):
18100  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18101  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18102  * v[eN,ebN,k,2]=zvelocity
18103  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18104  */
18105  __pyx_t_14 = __pyx_v_eN;
18106  __pyx_t_13 = __pyx_v_ebN;
18107  __pyx_t_12 = __pyx_v_k;
18108  __pyx_t_11 = 0;
18109  __pyx_t_15 = -1;
18110  if (__pyx_t_14 < 0) {
18111  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18112  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18113  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18114  if (__pyx_t_13 < 0) {
18115  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18116  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18117  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18118  if (__pyx_t_12 < 0) {
18119  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18120  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18121  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18122  if (__pyx_t_11 < 0) {
18123  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18124  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18125  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18126  if (unlikely(__pyx_t_15 != -1)) {
18127  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18128  __PYX_ERR(0, 833, __pyx_L1_error)
18129  }
18130  __pyx_t_19 = __pyx_v_eN;
18131  __pyx_t_18 = __pyx_v_ebN;
18132  __pyx_t_17 = __pyx_v_k;
18133  __pyx_t_16 = 1;
18134  __pyx_t_15 = -1;
18135  if (__pyx_t_19 < 0) {
18136  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18137  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18138  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18139  if (__pyx_t_18 < 0) {
18140  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18141  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18142  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18143  if (__pyx_t_17 < 0) {
18144  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18145  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18146  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18147  if (__pyx_t_16 < 0) {
18148  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18149  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18150  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18151  if (unlikely(__pyx_t_15 != -1)) {
18152  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18153  __PYX_ERR(0, 833, __pyx_L1_error)
18154  }
18155  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18156 
18157  /* "subsurfaceTransportFunctions.pyx":834
18158  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18159  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18160  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18161  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18162  * else:
18163  */
18164  __pyx_t_11 = __pyx_v_eN;
18165  __pyx_t_12 = __pyx_v_ebN;
18166  __pyx_t_13 = __pyx_v_k;
18167  __pyx_t_14 = 2;
18168  __pyx_t_15 = -1;
18169  if (__pyx_t_11 < 0) {
18170  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[0].shape;
18171  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18172  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18173  if (__pyx_t_12 < 0) {
18174  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[1].shape;
18175  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18176  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18177  if (__pyx_t_13 < 0) {
18178  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[2].shape;
18179  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18180  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18181  if (__pyx_t_14 < 0) {
18182  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[3].shape;
18183  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18184  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18185  if (unlikely(__pyx_t_15 != -1)) {
18186  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18187  __PYX_ERR(0, 834, __pyx_L1_error)
18188  }
18189  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18190 
18191  /* "subsurfaceTransportFunctions.pyx":835
18192  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18193  * v[eN,ebN,k,2]=zvelocity
18194  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18195  * else:
18196  * for eN in range(x.shape[0]):
18197  */
18198  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 835, __pyx_L1_error)
18199  __Pyx_GOTREF(__pyx_t_20);
18200  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 835, __pyx_L1_error)
18201  __Pyx_GOTREF(__pyx_t_21);
18202  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 835, __pyx_L1_error)
18203  __Pyx_GOTREF(__pyx_t_22);
18204  __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 835, __pyx_L1_error)
18205  __Pyx_GOTREF(__pyx_t_23);
18206  __Pyx_GIVEREF(__pyx_t_20);
18207  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
18208  __Pyx_GIVEREF(__pyx_t_21);
18209  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
18210  __Pyx_GIVEREF(__pyx_t_22);
18211  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
18212  __Pyx_INCREF(__pyx_slice_);
18213  __Pyx_GIVEREF(__pyx_slice_);
18214  PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_slice_);
18215  __pyx_t_20 = 0;
18216  __pyx_t_21 = 0;
18217  __pyx_t_22 = 0;
18218  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 835, __pyx_L1_error)
18219  __Pyx_GOTREF(__pyx_t_22);
18220  __pyx_t_24 = (__pyx_v_tForReversal - __pyx_v_t);
18221  __pyx_t_25 = (__pyx_v_tForReversal - 0.0);
18222  if (unlikely(__pyx_t_25 == 0)) {
18223  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18224  __PYX_ERR(0, 835, __pyx_L1_error)
18225  }
18226  __pyx_t_21 = PyFloat_FromDouble(((__pyx_t_24 / __pyx_t_25) * __pyx_v_clock)); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 835, __pyx_L1_error)
18227  __Pyx_GOTREF(__pyx_t_21);
18228  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_22, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 835, __pyx_L1_error)
18229  __Pyx_GOTREF(__pyx_t_20);
18230  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18231  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
18232  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_23, __pyx_t_20) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
18233  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18234  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18235  }
18236  }
18237  }
18238 
18239  /* "subsurfaceTransportFunctions.pyx":828
18240  * pi = M_PI
18241  * if v.shape[v.ndim-1] == 3:
18242  * if transient == 1: # <<<<<<<<<<<<<<
18243  * for eN in range(x.shape[0]):
18244  * for ebN in range(x.shape[1]):
18245  */
18246  goto __pyx_L4;
18247  }
18248 
18249  /* "subsurfaceTransportFunctions.pyx":837
18250  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18251  * else:
18252  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18253  * for ebN in range(x.shape[1]):
18254  * for k in range(x.shape[2]):
18255  */
18256  /*else*/ {
18257  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18258  __pyx_t_3 = __pyx_t_2;
18259  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18260  __pyx_v_eN = __pyx_t_4;
18261 
18262  /* "subsurfaceTransportFunctions.pyx":838
18263  * else:
18264  * for eN in range(x.shape[0]):
18265  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18266  * for k in range(x.shape[2]):
18267  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18268  */
18269  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18270  __pyx_t_6 = __pyx_t_5;
18271  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18272  __pyx_v_ebN = __pyx_t_7;
18273 
18274  /* "subsurfaceTransportFunctions.pyx":839
18275  * for eN in range(x.shape[0]):
18276  * for ebN in range(x.shape[1]):
18277  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18278  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18279  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18280  */
18281  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18282  __pyx_t_9 = __pyx_t_8;
18283  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18284  __pyx_v_k = __pyx_t_10;
18285 
18286  /* "subsurfaceTransportFunctions.pyx":840
18287  * for ebN in range(x.shape[1]):
18288  * for k in range(x.shape[2]):
18289  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18290  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18291  * v[eN,ebN,k,2]=zvelocity
18292  */
18293  __pyx_t_14 = __pyx_v_eN;
18294  __pyx_t_13 = __pyx_v_ebN;
18295  __pyx_t_12 = __pyx_v_k;
18296  __pyx_t_11 = 1;
18297  __pyx_t_15 = -1;
18298  if (__pyx_t_14 < 0) {
18299  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18300  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18301  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18302  if (__pyx_t_13 < 0) {
18303  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18304  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18305  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18306  if (__pyx_t_12 < 0) {
18307  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18308  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18309  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18310  if (__pyx_t_11 < 0) {
18311  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18312  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18313  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18314  if (unlikely(__pyx_t_15 != -1)) {
18315  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18316  __PYX_ERR(0, 840, __pyx_L1_error)
18317  }
18318  __pyx_t_16 = __pyx_v_eN;
18319  __pyx_t_17 = __pyx_v_ebN;
18320  __pyx_t_18 = __pyx_v_k;
18321  __pyx_t_19 = 0;
18322  __pyx_t_15 = -1;
18323  if (__pyx_t_16 < 0) {
18324  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18325  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18326  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18327  if (__pyx_t_17 < 0) {
18328  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18329  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18330  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18331  if (__pyx_t_18 < 0) {
18332  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18333  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18334  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18335  if (__pyx_t_19 < 0) {
18336  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18337  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18338  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18339  if (unlikely(__pyx_t_15 != -1)) {
18340  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18341  __PYX_ERR(0, 840, __pyx_L1_error)
18342  }
18343  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18344 
18345  /* "subsurfaceTransportFunctions.pyx":841
18346  * for k in range(x.shape[2]):
18347  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18348  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18349  * v[eN,ebN,k,2]=zvelocity
18350  * else:
18351  */
18352  __pyx_t_11 = __pyx_v_eN;
18353  __pyx_t_12 = __pyx_v_ebN;
18354  __pyx_t_13 = __pyx_v_k;
18355  __pyx_t_14 = 0;
18356  __pyx_t_15 = -1;
18357  if (__pyx_t_11 < 0) {
18358  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18359  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18360  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18361  if (__pyx_t_12 < 0) {
18362  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18363  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18364  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18365  if (__pyx_t_13 < 0) {
18366  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18367  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18368  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18369  if (__pyx_t_14 < 0) {
18370  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18371  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18372  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18373  if (unlikely(__pyx_t_15 != -1)) {
18374  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18375  __PYX_ERR(0, 841, __pyx_L1_error)
18376  }
18377  __pyx_t_19 = __pyx_v_eN;
18378  __pyx_t_18 = __pyx_v_ebN;
18379  __pyx_t_17 = __pyx_v_k;
18380  __pyx_t_16 = 1;
18381  __pyx_t_15 = -1;
18382  if (__pyx_t_19 < 0) {
18383  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18384  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18385  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18386  if (__pyx_t_18 < 0) {
18387  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18388  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18389  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18390  if (__pyx_t_17 < 0) {
18391  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18392  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18393  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18394  if (__pyx_t_16 < 0) {
18395  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18396  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18397  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18398  if (unlikely(__pyx_t_15 != -1)) {
18399  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18400  __PYX_ERR(0, 841, __pyx_L1_error)
18401  }
18402  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides))));
18403 
18404  /* "subsurfaceTransportFunctions.pyx":842
18405  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18406  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18407  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18408  * else:
18409  * assert v.shape[v.ndim-1] == 2
18410  */
18411  __pyx_t_14 = __pyx_v_eN;
18412  __pyx_t_13 = __pyx_v_ebN;
18413  __pyx_t_12 = __pyx_v_k;
18414  __pyx_t_11 = 2;
18415  __pyx_t_15 = -1;
18416  if (__pyx_t_14 < 0) {
18417  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
18418  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18419  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18420  if (__pyx_t_13 < 0) {
18421  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
18422  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18423  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18424  if (__pyx_t_12 < 0) {
18425  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
18426  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18427  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18428  if (__pyx_t_11 < 0) {
18429  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[3].shape;
18430  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18431  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18432  if (unlikely(__pyx_t_15 != -1)) {
18433  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18434  __PYX_ERR(0, 842, __pyx_L1_error)
18435  }
18436  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18437  }
18438  }
18439  }
18440  }
18441  __pyx_L4:;
18442 
18443  /* "subsurfaceTransportFunctions.pyx":827
18444  * cdef double pi
18445  * pi = M_PI
18446  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18447  * if transient == 1:
18448  * for eN in range(x.shape[0]):
18449  */
18450  goto __pyx_L3;
18451  }
18452 
18453  /* "subsurfaceTransportFunctions.pyx":844
18454  * v[eN,ebN,k,2]=zvelocity
18455  * else:
18456  * assert v.shape[v.ndim-1] == 2 # <<<<<<<<<<<<<<
18457  * if transient == 1:
18458  * for eN in range(x.shape[0]):
18459  */
18460  /*else*/ {
18461  #ifndef CYTHON_WITHOUT_ASSERTIONS
18462  if (unlikely(!Py_OptimizeFlag)) {
18463  if (unlikely(!(((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 2) != 0))) {
18464  PyErr_SetNone(PyExc_AssertionError);
18465  __PYX_ERR(0, 844, __pyx_L1_error)
18466  }
18467  }
18468  #endif
18469 
18470  /* "subsurfaceTransportFunctions.pyx":845
18471  * else:
18472  * assert v.shape[v.ndim-1] == 2
18473  * if transient == 1: # <<<<<<<<<<<<<<
18474  * for eN in range(x.shape[0]):
18475  * for ebN in range(x.shape[1]):
18476  */
18477  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18478  if (__pyx_t_1) {
18479 
18480  /* "subsurfaceTransportFunctions.pyx":846
18481  * assert v.shape[v.ndim-1] == 2
18482  * if transient == 1:
18483  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18484  * for ebN in range(x.shape[1]):
18485  * for k in range(x.shape[2]):
18486  */
18487  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18488  __pyx_t_3 = __pyx_t_2;
18489  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18490  __pyx_v_eN = __pyx_t_4;
18491 
18492  /* "subsurfaceTransportFunctions.pyx":847
18493  * if transient == 1:
18494  * for eN in range(x.shape[0]):
18495  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18496  * for k in range(x.shape[2]):
18497  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18498  */
18499  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18500  __pyx_t_6 = __pyx_t_5;
18501  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18502  __pyx_v_ebN = __pyx_t_7;
18503 
18504  /* "subsurfaceTransportFunctions.pyx":848
18505  * for eN in range(x.shape[0]):
18506  * for ebN in range(x.shape[1]):
18507  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18508  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18509  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18510  */
18511  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18512  __pyx_t_9 = __pyx_t_8;
18513  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18514  __pyx_v_k = __pyx_t_10;
18515 
18516  /* "subsurfaceTransportFunctions.pyx":849
18517  * for ebN in range(x.shape[1]):
18518  * for k in range(x.shape[2]):
18519  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18520  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18521  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18522  */
18523  __pyx_t_11 = __pyx_v_eN;
18524  __pyx_t_12 = __pyx_v_ebN;
18525  __pyx_t_13 = __pyx_v_k;
18526  __pyx_t_14 = 1;
18527  __pyx_t_15 = -1;
18528  if (__pyx_t_11 < 0) {
18529  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18530  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18531  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18532  if (__pyx_t_12 < 0) {
18533  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18534  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18535  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18536  if (__pyx_t_13 < 0) {
18537  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18538  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18539  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18540  if (__pyx_t_14 < 0) {
18541  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18542  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18543  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18544  if (unlikely(__pyx_t_15 != -1)) {
18545  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18546  __PYX_ERR(0, 849, __pyx_L1_error)
18547  }
18548  __pyx_t_16 = __pyx_v_eN;
18549  __pyx_t_17 = __pyx_v_ebN;
18550  __pyx_t_18 = __pyx_v_k;
18551  __pyx_t_19 = 0;
18552  __pyx_t_15 = -1;
18553  if (__pyx_t_16 < 0) {
18554  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18555  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18556  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18557  if (__pyx_t_17 < 0) {
18558  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18559  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18560  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18561  if (__pyx_t_18 < 0) {
18562  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18563  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18564  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18565  if (__pyx_t_19 < 0) {
18566  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18567  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18568  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18569  if (unlikely(__pyx_t_15 != -1)) {
18570  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18571  __PYX_ERR(0, 849, __pyx_L1_error)
18572  }
18573  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18574 
18575  /* "subsurfaceTransportFunctions.pyx":850
18576  * for k in range(x.shape[2]):
18577  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18578  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18579  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18580  * else:
18581  */
18582  __pyx_t_14 = __pyx_v_eN;
18583  __pyx_t_13 = __pyx_v_ebN;
18584  __pyx_t_12 = __pyx_v_k;
18585  __pyx_t_11 = 0;
18586  __pyx_t_15 = -1;
18587  if (__pyx_t_14 < 0) {
18588  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18589  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18590  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18591  if (__pyx_t_13 < 0) {
18592  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18593  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18594  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18595  if (__pyx_t_12 < 0) {
18596  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18597  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18598  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18599  if (__pyx_t_11 < 0) {
18600  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18601  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18602  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18603  if (unlikely(__pyx_t_15 != -1)) {
18604  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18605  __PYX_ERR(0, 850, __pyx_L1_error)
18606  }
18607  __pyx_t_19 = __pyx_v_eN;
18608  __pyx_t_18 = __pyx_v_ebN;
18609  __pyx_t_17 = __pyx_v_k;
18610  __pyx_t_16 = 1;
18611  __pyx_t_15 = -1;
18612  if (__pyx_t_19 < 0) {
18613  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18614  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18615  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18616  if (__pyx_t_18 < 0) {
18617  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18618  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18619  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18620  if (__pyx_t_17 < 0) {
18621  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18622  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18623  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18624  if (__pyx_t_16 < 0) {
18625  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18626  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18627  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18628  if (unlikely(__pyx_t_15 != -1)) {
18629  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18630  __PYX_ERR(0, 850, __pyx_L1_error)
18631  }
18632  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18633 
18634  /* "subsurfaceTransportFunctions.pyx":851
18635  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18636  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18637  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18638  * else:
18639  * for eN in range(x.shape[0]):
18640  */
18641  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 851, __pyx_L1_error)
18642  __Pyx_GOTREF(__pyx_t_23);
18643  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 851, __pyx_L1_error)
18644  __Pyx_GOTREF(__pyx_t_20);
18645  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 851, __pyx_L1_error)
18646  __Pyx_GOTREF(__pyx_t_21);
18647  __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 851, __pyx_L1_error)
18648  __Pyx_GOTREF(__pyx_t_22);
18649  __Pyx_GIVEREF(__pyx_t_23);
18650  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23);
18651  __Pyx_GIVEREF(__pyx_t_20);
18652  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
18653  __Pyx_GIVEREF(__pyx_t_21);
18654  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_21);
18655  __Pyx_INCREF(__pyx_slice_);
18656  __Pyx_GIVEREF(__pyx_slice_);
18657  PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_slice_);
18658  __pyx_t_23 = 0;
18659  __pyx_t_20 = 0;
18660  __pyx_t_21 = 0;
18661  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 851, __pyx_L1_error)
18662  __Pyx_GOTREF(__pyx_t_21);
18663  __pyx_t_25 = (__pyx_v_tForReversal - __pyx_v_t);
18664  __pyx_t_24 = (__pyx_v_tForReversal - 0.0);
18665  if (unlikely(__pyx_t_24 == 0)) {
18666  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18667  __PYX_ERR(0, 851, __pyx_L1_error)
18668  }
18669  __pyx_t_20 = PyFloat_FromDouble(((__pyx_t_25 / __pyx_t_24) * __pyx_v_clock)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 851, __pyx_L1_error)
18670  __Pyx_GOTREF(__pyx_t_20);
18671  __pyx_t_23 = PyNumber_InPlaceMultiply(__pyx_t_21, __pyx_t_20); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 851, __pyx_L1_error)
18672  __Pyx_GOTREF(__pyx_t_23);
18673  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
18674  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18675  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_23) < 0)) __PYX_ERR(0, 851, __pyx_L1_error)
18676  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18677  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18678  }
18679  }
18680  }
18681 
18682  /* "subsurfaceTransportFunctions.pyx":845
18683  * else:
18684  * assert v.shape[v.ndim-1] == 2
18685  * if transient == 1: # <<<<<<<<<<<<<<
18686  * for eN in range(x.shape[0]):
18687  * for ebN in range(x.shape[1]):
18688  */
18689  goto __pyx_L17;
18690  }
18691 
18692  /* "subsurfaceTransportFunctions.pyx":853
18693  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18694  * else:
18695  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18696  * for ebN in range(x.shape[1]):
18697  * for k in range(x.shape[2]):
18698  */
18699  /*else*/ {
18700  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18701  __pyx_t_3 = __pyx_t_2;
18702  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18703  __pyx_v_eN = __pyx_t_4;
18704 
18705  /* "subsurfaceTransportFunctions.pyx":854
18706  * else:
18707  * for eN in range(x.shape[0]):
18708  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18709  * for k in range(x.shape[2]):
18710  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18711  */
18712  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18713  __pyx_t_6 = __pyx_t_5;
18714  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18715  __pyx_v_ebN = __pyx_t_7;
18716 
18717  /* "subsurfaceTransportFunctions.pyx":855
18718  * for eN in range(x.shape[0]):
18719  * for ebN in range(x.shape[1]):
18720  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18721  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18722  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18723  */
18724  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18725  __pyx_t_9 = __pyx_t_8;
18726  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18727  __pyx_v_k = __pyx_t_10;
18728 
18729  /* "subsurfaceTransportFunctions.pyx":856
18730  * for ebN in range(x.shape[1]):
18731  * for k in range(x.shape[2]):
18732  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18733  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18734  *
18735  */
18736  __pyx_t_11 = __pyx_v_eN;
18737  __pyx_t_12 = __pyx_v_ebN;
18738  __pyx_t_13 = __pyx_v_k;
18739  __pyx_t_14 = 1;
18740  __pyx_t_15 = -1;
18741  if (__pyx_t_11 < 0) {
18742  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18743  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18744  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18745  if (__pyx_t_12 < 0) {
18746  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18747  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18748  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18749  if (__pyx_t_13 < 0) {
18750  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18751  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18752  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18753  if (__pyx_t_14 < 0) {
18754  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18755  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18756  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18757  if (unlikely(__pyx_t_15 != -1)) {
18758  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18759  __PYX_ERR(0, 856, __pyx_L1_error)
18760  }
18761  __pyx_t_16 = __pyx_v_eN;
18762  __pyx_t_17 = __pyx_v_ebN;
18763  __pyx_t_18 = __pyx_v_k;
18764  __pyx_t_19 = 0;
18765  __pyx_t_15 = -1;
18766  if (__pyx_t_16 < 0) {
18767  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18768  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18769  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18770  if (__pyx_t_17 < 0) {
18771  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18772  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18773  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18774  if (__pyx_t_18 < 0) {
18775  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18776  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18777  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18778  if (__pyx_t_19 < 0) {
18779  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18780  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18781  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18782  if (unlikely(__pyx_t_15 != -1)) {
18783  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18784  __PYX_ERR(0, 856, __pyx_L1_error)
18785  }
18786  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18787 
18788  /* "subsurfaceTransportFunctions.pyx":857
18789  * for k in range(x.shape[2]):
18790  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18791  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18792  *
18793  * def helicalElementVelocityEval3(int transient,
18794  */
18795  __pyx_t_14 = __pyx_v_eN;
18796  __pyx_t_13 = __pyx_v_ebN;
18797  __pyx_t_12 = __pyx_v_k;
18798  __pyx_t_11 = 0;
18799  __pyx_t_15 = -1;
18800  if (__pyx_t_14 < 0) {
18801  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18802  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18803  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18804  if (__pyx_t_13 < 0) {
18805  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18806  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18807  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18808  if (__pyx_t_12 < 0) {
18809  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18810  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18811  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18812  if (__pyx_t_11 < 0) {
18813  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18814  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18815  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18816  if (unlikely(__pyx_t_15 != -1)) {
18817  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18818  __PYX_ERR(0, 857, __pyx_L1_error)
18819  }
18820  __pyx_t_19 = __pyx_v_eN;
18821  __pyx_t_18 = __pyx_v_ebN;
18822  __pyx_t_17 = __pyx_v_k;
18823  __pyx_t_16 = 1;
18824  __pyx_t_15 = -1;
18825  if (__pyx_t_19 < 0) {
18826  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18827  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18828  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18829  if (__pyx_t_18 < 0) {
18830  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18831  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18832  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18833  if (__pyx_t_17 < 0) {
18834  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18835  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18836  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18837  if (__pyx_t_16 < 0) {
18838  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18839  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18840  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18841  if (unlikely(__pyx_t_15 != -1)) {
18842  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18843  __PYX_ERR(0, 857, __pyx_L1_error)
18844  }
18845  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18846  }
18847  }
18848  }
18849  }
18850  __pyx_L17:;
18851  }
18852  __pyx_L3:;
18853 
18854  /* "subsurfaceTransportFunctions.pyx":816
18855  *
18856  *
18857  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18858  * double t,
18859  * double tForReversal,
18860  */
18861 
18862  /* function exit code */
18863  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18864  goto __pyx_L0;
18865  __pyx_L1_error:;
18866  __Pyx_XDECREF(__pyx_t_20);
18867  __Pyx_XDECREF(__pyx_t_21);
18868  __Pyx_XDECREF(__pyx_t_22);
18869  __Pyx_XDECREF(__pyx_t_23);
18870  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18871  __Pyx_PyThreadState_declare
18872  __Pyx_PyThreadState_assign
18873  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18874  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18875  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18876  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18877  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18878  __pyx_r = NULL;
18879  goto __pyx_L2;
18880  __pyx_L0:;
18881  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18882  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18883  __pyx_L2:;
18884  __Pyx_XGIVEREF(__pyx_r);
18885  __Pyx_RefNannyFinishContext();
18886  return __pyx_r;
18887 }
18888 
18889 /* "subsurfaceTransportFunctions.pyx":859
18890  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18891  *
18892  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
18893  * double t,
18894  * double tForReversal,
18895  */
18896 
18897 /* Python wrapper */
18898 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18899 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
18900 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18901  int __pyx_v_transient;
18902  double __pyx_v_t;
18903  double __pyx_v_tForReversal;
18904  double __pyx_v_clock;
18905  double __pyx_v_zVelocity;
18906  double __pyx_v_xc;
18907  double __pyx_v_yc;
18908  PyArrayObject *__pyx_v_x = 0;
18909  PyArrayObject *__pyx_v_v = 0;
18910  int __pyx_lineno = 0;
18911  const char *__pyx_filename = NULL;
18912  int __pyx_clineno = 0;
18913  PyObject *__pyx_r = 0;
18914  __Pyx_RefNannyDeclarations
18915  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
18916  {
18917  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
18918  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
18919  if (unlikely(__pyx_kwds)) {
18920  Py_ssize_t kw_args;
18921  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18922  switch (pos_args) {
18923  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
18924  CYTHON_FALLTHROUGH;
18925  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
18926  CYTHON_FALLTHROUGH;
18927  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
18928  CYTHON_FALLTHROUGH;
18929  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
18930  CYTHON_FALLTHROUGH;
18931  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18932  CYTHON_FALLTHROUGH;
18933  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18934  CYTHON_FALLTHROUGH;
18935  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18936  CYTHON_FALLTHROUGH;
18937  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18938  CYTHON_FALLTHROUGH;
18939  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18940  CYTHON_FALLTHROUGH;
18941  case 0: break;
18942  default: goto __pyx_L5_argtuple_error;
18943  }
18944  kw_args = PyDict_Size(__pyx_kwds);
18945  switch (pos_args) {
18946  case 0:
18947  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
18948  else goto __pyx_L5_argtuple_error;
18949  CYTHON_FALLTHROUGH;
18950  case 1:
18951  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
18952  else {
18953  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); __PYX_ERR(0, 859, __pyx_L3_error)
18954  }
18955  CYTHON_FALLTHROUGH;
18956  case 2:
18957  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
18958  else {
18959  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); __PYX_ERR(0, 859, __pyx_L3_error)
18960  }
18961  CYTHON_FALLTHROUGH;
18962  case 3:
18963  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
18964  else {
18965  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); __PYX_ERR(0, 859, __pyx_L3_error)
18966  }
18967  CYTHON_FALLTHROUGH;
18968  case 4:
18969  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
18970  else {
18971  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); __PYX_ERR(0, 859, __pyx_L3_error)
18972  }
18973  CYTHON_FALLTHROUGH;
18974  case 5:
18975  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
18976  else {
18977  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); __PYX_ERR(0, 859, __pyx_L3_error)
18978  }
18979  CYTHON_FALLTHROUGH;
18980  case 6:
18981  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
18982  else {
18983  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); __PYX_ERR(0, 859, __pyx_L3_error)
18984  }
18985  CYTHON_FALLTHROUGH;
18986  case 7:
18987  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
18988  else {
18989  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); __PYX_ERR(0, 859, __pyx_L3_error)
18990  }
18991  CYTHON_FALLTHROUGH;
18992  case 8:
18993  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
18994  else {
18995  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); __PYX_ERR(0, 859, __pyx_L3_error)
18996  }
18997  }
18998  if (unlikely(kw_args > 0)) {
18999  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
19000  }
19001  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19002  goto __pyx_L5_argtuple_error;
19003  } else {
19004  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19005  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19006  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19007  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19008  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19009  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19010  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19011  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19012  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19013  }
19014  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
19015  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
19016  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L3_error)
19017  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L3_error)
19018  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L3_error)
19019  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19020  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19021  __pyx_v_x = ((PyArrayObject *)values[7]);
19022  __pyx_v_v = ((PyArrayObject *)values[8]);
19023  }
19024  goto __pyx_L4_argument_unpacking_done;
19025  __pyx_L5_argtuple_error:;
19026  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
19027  __pyx_L3_error:;
19028  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19029  __Pyx_RefNannyFinishContext();
19030  return NULL;
19031  __pyx_L4_argument_unpacking_done:;
19032  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 865, __pyx_L1_error)
19033  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 866, __pyx_L1_error)
19034  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19035 
19036  /* function exit code */
19037  goto __pyx_L0;
19038  __pyx_L1_error:;
19039  __pyx_r = NULL;
19040  __pyx_L0:;
19041  __Pyx_RefNannyFinishContext();
19042  return __pyx_r;
19043 }
19044 
19045 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19046  int __pyx_v_eN;
19047  int __pyx_v_k;
19048  double __pyx_v_pi;
19049  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19050  __Pyx_Buffer __pyx_pybuffer_v;
19051  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19052  __Pyx_Buffer __pyx_pybuffer_x;
19053  PyObject *__pyx_r = NULL;
19054  __Pyx_RefNannyDeclarations
19055  int __pyx_t_1;
19056  npy_intp __pyx_t_2;
19057  npy_intp __pyx_t_3;
19058  int __pyx_t_4;
19059  npy_intp __pyx_t_5;
19060  npy_intp __pyx_t_6;
19061  int __pyx_t_7;
19062  Py_ssize_t __pyx_t_8;
19063  Py_ssize_t __pyx_t_9;
19064  Py_ssize_t __pyx_t_10;
19065  int __pyx_t_11;
19066  Py_ssize_t __pyx_t_12;
19067  Py_ssize_t __pyx_t_13;
19068  Py_ssize_t __pyx_t_14;
19069  PyObject *__pyx_t_15 = NULL;
19070  PyObject *__pyx_t_16 = NULL;
19071  PyObject *__pyx_t_17 = NULL;
19072  double __pyx_t_18;
19073  double __pyx_t_19;
19074  PyObject *__pyx_t_20 = NULL;
19075  int __pyx_lineno = 0;
19076  const char *__pyx_filename = NULL;
19077  int __pyx_clineno = 0;
19078  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
19079  __pyx_pybuffer_x.pybuffer.buf = NULL;
19080  __pyx_pybuffer_x.refcount = 0;
19081  __pyx_pybuffernd_x.data = NULL;
19082  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19083  __pyx_pybuffer_v.pybuffer.buf = NULL;
19084  __pyx_pybuffer_v.refcount = 0;
19085  __pyx_pybuffernd_v.data = NULL;
19086  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19087  {
19088  __Pyx_BufFmt_StackElem __pyx_stack[1];
19089  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19090  }
19091  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
19092  {
19093  __Pyx_BufFmt_StackElem __pyx_stack[1];
19094  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19095  }
19096  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19097 
19098  /* "subsurfaceTransportFunctions.pyx":869
19099  * cdef int eN,k
19100  * cdef double pi
19101  * pi = M_PI # <<<<<<<<<<<<<<
19102  * if transient == 1:
19103  * for eN in range(x.shape[0]):
19104  */
19105  __pyx_v_pi = M_PI;
19106 
19107  /* "subsurfaceTransportFunctions.pyx":870
19108  * cdef double pi
19109  * pi = M_PI
19110  * if transient == 1: # <<<<<<<<<<<<<<
19111  * for eN in range(x.shape[0]):
19112  * for k in range(x.shape[1]):
19113  */
19114  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19115  if (__pyx_t_1) {
19116 
19117  /* "subsurfaceTransportFunctions.pyx":871
19118  * pi = M_PI
19119  * if transient == 1:
19120  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19121  * for k in range(x.shape[1]):
19122  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19123  */
19124  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19125  __pyx_t_3 = __pyx_t_2;
19126  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19127  __pyx_v_eN = __pyx_t_4;
19128 
19129  /* "subsurfaceTransportFunctions.pyx":872
19130  * if transient == 1:
19131  * for eN in range(x.shape[0]):
19132  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19133  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19134  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19135  */
19136  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19137  __pyx_t_6 = __pyx_t_5;
19138  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19139  __pyx_v_k = __pyx_t_7;
19140 
19141  /* "subsurfaceTransportFunctions.pyx":873
19142  * for eN in range(x.shape[0]):
19143  * for k in range(x.shape[1]):
19144  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19145  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19146  * v[eN,k,2]=zVelocity
19147  */
19148  __pyx_t_8 = __pyx_v_eN;
19149  __pyx_t_9 = __pyx_v_k;
19150  __pyx_t_10 = 1;
19151  __pyx_t_11 = -1;
19152  if (__pyx_t_8 < 0) {
19153  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19154  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19155  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19156  if (__pyx_t_9 < 0) {
19157  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19158  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19159  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19160  if (__pyx_t_10 < 0) {
19161  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19162  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19163  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19164  if (unlikely(__pyx_t_11 != -1)) {
19165  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19166  __PYX_ERR(0, 873, __pyx_L1_error)
19167  }
19168  __pyx_t_12 = __pyx_v_eN;
19169  __pyx_t_13 = __pyx_v_k;
19170  __pyx_t_14 = 0;
19171  __pyx_t_11 = -1;
19172  if (__pyx_t_12 < 0) {
19173  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19174  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19175  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19176  if (__pyx_t_13 < 0) {
19177  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19178  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19179  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19180  if (__pyx_t_14 < 0) {
19181  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19182  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19183  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19184  if (unlikely(__pyx_t_11 != -1)) {
19185  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19186  __PYX_ERR(0, 873, __pyx_L1_error)
19187  }
19188  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19189 
19190  /* "subsurfaceTransportFunctions.pyx":874
19191  * for k in range(x.shape[1]):
19192  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19193  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19194  * v[eN,k,2]=zVelocity
19195  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19196  */
19197  __pyx_t_10 = __pyx_v_eN;
19198  __pyx_t_9 = __pyx_v_k;
19199  __pyx_t_8 = 0;
19200  __pyx_t_11 = -1;
19201  if (__pyx_t_10 < 0) {
19202  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
19203  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19204  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19205  if (__pyx_t_9 < 0) {
19206  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19207  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19208  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19209  if (__pyx_t_8 < 0) {
19210  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
19211  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19212  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19213  if (unlikely(__pyx_t_11 != -1)) {
19214  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19215  __PYX_ERR(0, 874, __pyx_L1_error)
19216  }
19217  __pyx_t_14 = __pyx_v_eN;
19218  __pyx_t_13 = __pyx_v_k;
19219  __pyx_t_12 = 1;
19220  __pyx_t_11 = -1;
19221  if (__pyx_t_14 < 0) {
19222  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
19223  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
19224  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19225  if (__pyx_t_13 < 0) {
19226  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19227  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19228  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19229  if (__pyx_t_12 < 0) {
19230  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
19231  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
19232  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19233  if (unlikely(__pyx_t_11 != -1)) {
19234  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19235  __PYX_ERR(0, 874, __pyx_L1_error)
19236  }
19237  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
19238 
19239  /* "subsurfaceTransportFunctions.pyx":875
19240  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19241  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19242  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19243  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19244  * else:
19245  */
19246  __pyx_t_8 = __pyx_v_eN;
19247  __pyx_t_9 = __pyx_v_k;
19248  __pyx_t_10 = 2;
19249  __pyx_t_11 = -1;
19250  if (__pyx_t_8 < 0) {
19251  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[0].shape;
19252  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19253  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19254  if (__pyx_t_9 < 0) {
19255  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
19256  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19257  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19258  if (__pyx_t_10 < 0) {
19259  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[2].shape;
19260  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19261  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19262  if (unlikely(__pyx_t_11 != -1)) {
19263  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19264  __PYX_ERR(0, 875, __pyx_L1_error)
19265  }
19266  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19267 
19268  /* "subsurfaceTransportFunctions.pyx":876
19269  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19270  * v[eN,k,2]=zVelocity
19271  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19272  * else:
19273  * for eN in range(x.shape[0]):
19274  */
19275  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 876, __pyx_L1_error)
19276  __Pyx_GOTREF(__pyx_t_15);
19277  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 876, __pyx_L1_error)
19278  __Pyx_GOTREF(__pyx_t_16);
19279  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 876, __pyx_L1_error)
19280  __Pyx_GOTREF(__pyx_t_17);
19281  __Pyx_GIVEREF(__pyx_t_15);
19282  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
19283  __Pyx_GIVEREF(__pyx_t_16);
19284  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
19285  __Pyx_INCREF(__pyx_slice_);
19286  __Pyx_GIVEREF(__pyx_slice_);
19287  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_slice_);
19288  __pyx_t_15 = 0;
19289  __pyx_t_16 = 0;
19290  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 876, __pyx_L1_error)
19291  __Pyx_GOTREF(__pyx_t_16);
19292  __pyx_t_18 = (__pyx_v_pi * __pyx_v_t);
19293  __pyx_t_19 = (__pyx_v_tForReversal * 2.0);
19294  if (unlikely(__pyx_t_19 == 0)) {
19295  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19296  __PYX_ERR(0, 876, __pyx_L1_error)
19297  }
19298  __pyx_t_15 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_18 / __pyx_t_19)))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 876, __pyx_L1_error)
19299  __Pyx_GOTREF(__pyx_t_15);
19300  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 876, __pyx_L1_error)
19301  __Pyx_GOTREF(__pyx_t_20);
19302  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
19303  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
19304  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_17, __pyx_t_20) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
19305  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
19306  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19307  }
19308  }
19309 
19310  /* "subsurfaceTransportFunctions.pyx":870
19311  * cdef double pi
19312  * pi = M_PI
19313  * if transient == 1: # <<<<<<<<<<<<<<
19314  * for eN in range(x.shape[0]):
19315  * for k in range(x.shape[1]):
19316  */
19317  goto __pyx_L3;
19318  }
19319 
19320  /* "subsurfaceTransportFunctions.pyx":878
19321  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19322  * else:
19323  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19324  * for k in range(x.shape[1]):
19325  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19326  */
19327  /*else*/ {
19328  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19329  __pyx_t_3 = __pyx_t_2;
19330  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19331  __pyx_v_eN = __pyx_t_4;
19332 
19333  /* "subsurfaceTransportFunctions.pyx":879
19334  * else:
19335  * for eN in range(x.shape[0]):
19336  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19337  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19338  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19339  */
19340  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19341  __pyx_t_6 = __pyx_t_5;
19342  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19343  __pyx_v_k = __pyx_t_7;
19344 
19345  /* "subsurfaceTransportFunctions.pyx":880
19346  * for eN in range(x.shape[0]):
19347  * for k in range(x.shape[1]):
19348  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19349  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19350  * v[eN,k,2]=zVelocity
19351  */
19352  __pyx_t_10 = __pyx_v_eN;
19353  __pyx_t_9 = __pyx_v_k;
19354  __pyx_t_8 = 1;
19355  __pyx_t_11 = -1;
19356  if (__pyx_t_10 < 0) {
19357  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
19358  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19359  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19360  if (__pyx_t_9 < 0) {
19361  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19362  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19363  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19364  if (__pyx_t_8 < 0) {
19365  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
19366  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19367  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19368  if (unlikely(__pyx_t_11 != -1)) {
19369  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19370  __PYX_ERR(0, 880, __pyx_L1_error)
19371  }
19372  __pyx_t_12 = __pyx_v_eN;
19373  __pyx_t_13 = __pyx_v_k;
19374  __pyx_t_14 = 0;
19375  __pyx_t_11 = -1;
19376  if (__pyx_t_12 < 0) {
19377  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19378  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19379  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19380  if (__pyx_t_13 < 0) {
19381  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19382  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19383  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19384  if (__pyx_t_14 < 0) {
19385  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19386  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19387  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19388  if (unlikely(__pyx_t_11 != -1)) {
19389  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19390  __PYX_ERR(0, 880, __pyx_L1_error)
19391  }
19392  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19393 
19394  /* "subsurfaceTransportFunctions.pyx":881
19395  * for k in range(x.shape[1]):
19396  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19397  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19398  * v[eN,k,2]=zVelocity
19399  *
19400  */
19401  __pyx_t_8 = __pyx_v_eN;
19402  __pyx_t_9 = __pyx_v_k;
19403  __pyx_t_10 = 0;
19404  __pyx_t_11 = -1;
19405  if (__pyx_t_8 < 0) {
19406  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19407  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19408  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19409  if (__pyx_t_9 < 0) {
19410  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19411  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19412  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19413  if (__pyx_t_10 < 0) {
19414  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19415  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19416  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19417  if (unlikely(__pyx_t_11 != -1)) {
19418  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19419  __PYX_ERR(0, 881, __pyx_L1_error)
19420  }
19421  __pyx_t_14 = __pyx_v_eN;
19422  __pyx_t_13 = __pyx_v_k;
19423  __pyx_t_12 = 1;
19424  __pyx_t_11 = -1;
19425  if (__pyx_t_14 < 0) {
19426  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
19427  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
19428  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19429  if (__pyx_t_13 < 0) {
19430  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19431  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19432  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19433  if (__pyx_t_12 < 0) {
19434  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
19435  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
19436  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19437  if (unlikely(__pyx_t_11 != -1)) {
19438  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19439  __PYX_ERR(0, 881, __pyx_L1_error)
19440  }
19441  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides))));
19442 
19443  /* "subsurfaceTransportFunctions.pyx":882
19444  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19445  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19446  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19447  *
19448  * def helicalElementVelocityEval4(int transient,
19449  */
19450  __pyx_t_10 = __pyx_v_eN;
19451  __pyx_t_9 = __pyx_v_k;
19452  __pyx_t_8 = 2;
19453  __pyx_t_11 = -1;
19454  if (__pyx_t_10 < 0) {
19455  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
19456  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19457  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19458  if (__pyx_t_9 < 0) {
19459  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
19460  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19461  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19462  if (__pyx_t_8 < 0) {
19463  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[2].shape;
19464  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19465  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19466  if (unlikely(__pyx_t_11 != -1)) {
19467  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19468  __PYX_ERR(0, 882, __pyx_L1_error)
19469  }
19470  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19471  }
19472  }
19473  }
19474  __pyx_L3:;
19475 
19476  /* "subsurfaceTransportFunctions.pyx":859
19477  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19478  *
19479  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19480  * double t,
19481  * double tForReversal,
19482  */
19483 
19484  /* function exit code */
19485  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19486  goto __pyx_L0;
19487  __pyx_L1_error:;
19488  __Pyx_XDECREF(__pyx_t_15);
19489  __Pyx_XDECREF(__pyx_t_16);
19490  __Pyx_XDECREF(__pyx_t_17);
19491  __Pyx_XDECREF(__pyx_t_20);
19492  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19493  __Pyx_PyThreadState_declare
19494  __Pyx_PyThreadState_assign
19495  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19496  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19497  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19498  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19499  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19500  __pyx_r = NULL;
19501  goto __pyx_L2;
19502  __pyx_L0:;
19503  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19504  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19505  __pyx_L2:;
19506  __Pyx_XGIVEREF(__pyx_r);
19507  __Pyx_RefNannyFinishContext();
19508  return __pyx_r;
19509 }
19510 
19511 /* "subsurfaceTransportFunctions.pyx":884
19512  * v[eN,k,2]=zVelocity
19513  *
19514  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19515  * double t,
19516  * double tForReversal,
19517  */
19518 
19519 /* Python wrapper */
19520 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19521 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
19522 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19523  int __pyx_v_transient;
19524  double __pyx_v_t;
19525  double __pyx_v_tForReversal;
19526  double __pyx_v_clock;
19527  double __pyx_v_zVelocity;
19528  double __pyx_v_xc;
19529  double __pyx_v_yc;
19530  PyArrayObject *__pyx_v_x = 0;
19531  PyArrayObject *__pyx_v_v = 0;
19532  int __pyx_lineno = 0;
19533  const char *__pyx_filename = NULL;
19534  int __pyx_clineno = 0;
19535  PyObject *__pyx_r = 0;
19536  __Pyx_RefNannyDeclarations
19537  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
19538  {
19539  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19540  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19541  if (unlikely(__pyx_kwds)) {
19542  Py_ssize_t kw_args;
19543  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19544  switch (pos_args) {
19545  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19546  CYTHON_FALLTHROUGH;
19547  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19548  CYTHON_FALLTHROUGH;
19549  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19550  CYTHON_FALLTHROUGH;
19551  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19552  CYTHON_FALLTHROUGH;
19553  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19554  CYTHON_FALLTHROUGH;
19555  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19556  CYTHON_FALLTHROUGH;
19557  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19558  CYTHON_FALLTHROUGH;
19559  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19560  CYTHON_FALLTHROUGH;
19561  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19562  CYTHON_FALLTHROUGH;
19563  case 0: break;
19564  default: goto __pyx_L5_argtuple_error;
19565  }
19566  kw_args = PyDict_Size(__pyx_kwds);
19567  switch (pos_args) {
19568  case 0:
19569  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19570  else goto __pyx_L5_argtuple_error;
19571  CYTHON_FALLTHROUGH;
19572  case 1:
19573  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19574  else {
19575  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); __PYX_ERR(0, 884, __pyx_L3_error)
19576  }
19577  CYTHON_FALLTHROUGH;
19578  case 2:
19579  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19580  else {
19581  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); __PYX_ERR(0, 884, __pyx_L3_error)
19582  }
19583  CYTHON_FALLTHROUGH;
19584  case 3:
19585  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19586  else {
19587  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); __PYX_ERR(0, 884, __pyx_L3_error)
19588  }
19589  CYTHON_FALLTHROUGH;
19590  case 4:
19591  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19592  else {
19593  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); __PYX_ERR(0, 884, __pyx_L3_error)
19594  }
19595  CYTHON_FALLTHROUGH;
19596  case 5:
19597  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19598  else {
19599  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); __PYX_ERR(0, 884, __pyx_L3_error)
19600  }
19601  CYTHON_FALLTHROUGH;
19602  case 6:
19603  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19604  else {
19605  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); __PYX_ERR(0, 884, __pyx_L3_error)
19606  }
19607  CYTHON_FALLTHROUGH;
19608  case 7:
19609  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19610  else {
19611  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); __PYX_ERR(0, 884, __pyx_L3_error)
19612  }
19613  CYTHON_FALLTHROUGH;
19614  case 8:
19615  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19616  else {
19617  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); __PYX_ERR(0, 884, __pyx_L3_error)
19618  }
19619  }
19620  if (unlikely(kw_args > 0)) {
19621  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) __PYX_ERR(0, 884, __pyx_L3_error)
19622  }
19623  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19624  goto __pyx_L5_argtuple_error;
19625  } else {
19626  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19627  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19628  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19629  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19630  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19631  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19632  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19633  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19634  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19635  }
19636  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)
19637  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
19638  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
19639  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
19640  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error)
19641  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19642  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19643  __pyx_v_x = ((PyArrayObject *)values[7]);
19644  __pyx_v_v = ((PyArrayObject *)values[8]);
19645  }
19646  goto __pyx_L4_argument_unpacking_done;
19647  __pyx_L5_argtuple_error:;
19648  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
19649  __pyx_L3_error:;
19650  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19651  __Pyx_RefNannyFinishContext();
19652  return NULL;
19653  __pyx_L4_argument_unpacking_done:;
19654  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 890, __pyx_L1_error)
19655  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 891, __pyx_L1_error)
19656  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19657 
19658  /* function exit code */
19659  goto __pyx_L0;
19660  __pyx_L1_error:;
19661  __pyx_r = NULL;
19662  __pyx_L0:;
19663  __Pyx_RefNannyFinishContext();
19664  return __pyx_r;
19665 }
19666 
19667 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19668  int __pyx_v_eN;
19669  int __pyx_v_ebN;
19670  int __pyx_v_k;
19671  double __pyx_v_pi;
19672  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19673  __Pyx_Buffer __pyx_pybuffer_v;
19674  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19675  __Pyx_Buffer __pyx_pybuffer_x;
19676  PyObject *__pyx_r = NULL;
19677  __Pyx_RefNannyDeclarations
19678  int __pyx_t_1;
19679  npy_intp __pyx_t_2;
19680  npy_intp __pyx_t_3;
19681  int __pyx_t_4;
19682  npy_intp __pyx_t_5;
19683  npy_intp __pyx_t_6;
19684  int __pyx_t_7;
19685  npy_intp __pyx_t_8;
19686  npy_intp __pyx_t_9;
19687  int __pyx_t_10;
19688  Py_ssize_t __pyx_t_11;
19689  Py_ssize_t __pyx_t_12;
19690  Py_ssize_t __pyx_t_13;
19691  Py_ssize_t __pyx_t_14;
19692  int __pyx_t_15;
19693  Py_ssize_t __pyx_t_16;
19694  Py_ssize_t __pyx_t_17;
19695  Py_ssize_t __pyx_t_18;
19696  Py_ssize_t __pyx_t_19;
19697  PyObject *__pyx_t_20 = NULL;
19698  PyObject *__pyx_t_21 = NULL;
19699  PyObject *__pyx_t_22 = NULL;
19700  PyObject *__pyx_t_23 = NULL;
19701  double __pyx_t_24;
19702  double __pyx_t_25;
19703  int __pyx_lineno = 0;
19704  const char *__pyx_filename = NULL;
19705  int __pyx_clineno = 0;
19706  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
19707  __pyx_pybuffer_x.pybuffer.buf = NULL;
19708  __pyx_pybuffer_x.refcount = 0;
19709  __pyx_pybuffernd_x.data = NULL;
19710  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19711  __pyx_pybuffer_v.pybuffer.buf = NULL;
19712  __pyx_pybuffer_v.refcount = 0;
19713  __pyx_pybuffernd_v.data = NULL;
19714  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19715  {
19716  __Pyx_BufFmt_StackElem __pyx_stack[1];
19717  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19718  }
19719  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
19720  {
19721  __Pyx_BufFmt_StackElem __pyx_stack[1];
19722  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19723  }
19724  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19725 
19726  /* "subsurfaceTransportFunctions.pyx":894
19727  * cdef int eN,ebN,k
19728  * cdef double pi
19729  * pi = M_PI # <<<<<<<<<<<<<<
19730  * if transient == 1:
19731  * for eN in range(x.shape[0]):
19732  */
19733  __pyx_v_pi = M_PI;
19734 
19735  /* "subsurfaceTransportFunctions.pyx":895
19736  * cdef double pi
19737  * pi = M_PI
19738  * if transient == 1: # <<<<<<<<<<<<<<
19739  * for eN in range(x.shape[0]):
19740  * for ebN in range(x.shape[1]):
19741  */
19742  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19743  if (__pyx_t_1) {
19744 
19745  /* "subsurfaceTransportFunctions.pyx":896
19746  * pi = M_PI
19747  * if transient == 1:
19748  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19749  * for ebN in range(x.shape[1]):
19750  * for k in range(x.shape[2]):
19751  */
19752  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19753  __pyx_t_3 = __pyx_t_2;
19754  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19755  __pyx_v_eN = __pyx_t_4;
19756 
19757  /* "subsurfaceTransportFunctions.pyx":897
19758  * if transient == 1:
19759  * for eN in range(x.shape[0]):
19760  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19761  * for k in range(x.shape[2]):
19762  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19763  */
19764  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19765  __pyx_t_6 = __pyx_t_5;
19766  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19767  __pyx_v_ebN = __pyx_t_7;
19768 
19769  /* "subsurfaceTransportFunctions.pyx":898
19770  * for eN in range(x.shape[0]):
19771  * for ebN in range(x.shape[1]):
19772  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19773  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19774  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19775  */
19776  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
19777  __pyx_t_9 = __pyx_t_8;
19778  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
19779  __pyx_v_k = __pyx_t_10;
19780 
19781  /* "subsurfaceTransportFunctions.pyx":899
19782  * for ebN in range(x.shape[1]):
19783  * for k in range(x.shape[2]):
19784  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
19785  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19786  * v[eN,ebN,k,2]=zVelocity
19787  */
19788  __pyx_t_11 = __pyx_v_eN;
19789  __pyx_t_12 = __pyx_v_ebN;
19790  __pyx_t_13 = __pyx_v_k;
19791  __pyx_t_14 = 1;
19792  __pyx_t_15 = -1;
19793  if (__pyx_t_11 < 0) {
19794  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
19795  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
19796  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19797  if (__pyx_t_12 < 0) {
19798  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
19799  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
19800  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
19801  if (__pyx_t_13 < 0) {
19802  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
19803  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
19804  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
19805  if (__pyx_t_14 < 0) {
19806  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
19807  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
19808  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19809  if (unlikely(__pyx_t_15 != -1)) {
19810  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19811  __PYX_ERR(0, 899, __pyx_L1_error)
19812  }
19813  __pyx_t_16 = __pyx_v_eN;
19814  __pyx_t_17 = __pyx_v_ebN;
19815  __pyx_t_18 = __pyx_v_k;
19816  __pyx_t_19 = 0;
19817  __pyx_t_15 = -1;
19818  if (__pyx_t_16 < 0) {
19819  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
19820  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
19821  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19822  if (__pyx_t_17 < 0) {
19823  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
19824  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
19825  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19826  if (__pyx_t_18 < 0) {
19827  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
19828  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
19829  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19830  if (__pyx_t_19 < 0) {
19831  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
19832  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
19833  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19834  if (unlikely(__pyx_t_15 != -1)) {
19835  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19836  __PYX_ERR(0, 899, __pyx_L1_error)
19837  }
19838  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
19839 
19840  /* "subsurfaceTransportFunctions.pyx":900
19841  * for k in range(x.shape[2]):
19842  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19843  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
19844  * v[eN,ebN,k,2]=zVelocity
19845  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19846  */
19847  __pyx_t_14 = __pyx_v_eN;
19848  __pyx_t_13 = __pyx_v_ebN;
19849  __pyx_t_12 = __pyx_v_k;
19850  __pyx_t_11 = 0;
19851  __pyx_t_15 = -1;
19852  if (__pyx_t_14 < 0) {
19853  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
19854  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
19855  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19856  if (__pyx_t_13 < 0) {
19857  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
19858  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
19859  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
19860  if (__pyx_t_12 < 0) {
19861  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
19862  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
19863  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
19864  if (__pyx_t_11 < 0) {
19865  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
19866  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
19867  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19868  if (unlikely(__pyx_t_15 != -1)) {
19869  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19870  __PYX_ERR(0, 900, __pyx_L1_error)
19871  }
19872  __pyx_t_19 = __pyx_v_eN;
19873  __pyx_t_18 = __pyx_v_ebN;
19874  __pyx_t_17 = __pyx_v_k;
19875  __pyx_t_16 = 1;
19876  __pyx_t_15 = -1;
19877  if (__pyx_t_19 < 0) {
19878  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
19879  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
19880  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19881  if (__pyx_t_18 < 0) {
19882  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
19883  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
19884  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19885  if (__pyx_t_17 < 0) {
19886  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
19887  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
19888  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19889  if (__pyx_t_16 < 0) {
19890  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
19891  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
19892  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19893  if (unlikely(__pyx_t_15 != -1)) {
19894  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19895  __PYX_ERR(0, 900, __pyx_L1_error)
19896  }
19897  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
19898 
19899  /* "subsurfaceTransportFunctions.pyx":901
19900  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19901  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19902  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
19903  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19904  * else:
19905  */
19906  __pyx_t_11 = __pyx_v_eN;
19907  __pyx_t_12 = __pyx_v_ebN;
19908  __pyx_t_13 = __pyx_v_k;
19909  __pyx_t_14 = 2;
19910  __pyx_t_15 = -1;
19911  if (__pyx_t_11 < 0) {
19912  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[0].shape;
19913  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
19914  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19915  if (__pyx_t_12 < 0) {
19916  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[1].shape;
19917  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
19918  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19919  if (__pyx_t_13 < 0) {
19920  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[2].shape;
19921  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
19922  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19923  if (__pyx_t_14 < 0) {
19924  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[3].shape;
19925  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
19926  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19927  if (unlikely(__pyx_t_15 != -1)) {
19928  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19929  __PYX_ERR(0, 901, __pyx_L1_error)
19930  }
19931  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
19932 
19933  /* "subsurfaceTransportFunctions.pyx":902
19934  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19935  * v[eN,ebN,k,2]=zVelocity
19936  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19937  * else:
19938  * for eN in range(x.shape[0]):
19939  */
19940  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L1_error)
19941  __Pyx_GOTREF(__pyx_t_20);
19942  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 902, __pyx_L1_error)
19943  __Pyx_GOTREF(__pyx_t_21);
19944  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 902, __pyx_L1_error)
19945  __Pyx_GOTREF(__pyx_t_22);
19946  __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 902, __pyx_L1_error)
19947  __Pyx_GOTREF(__pyx_t_23);
19948  __Pyx_GIVEREF(__pyx_t_20);
19949  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
19950  __Pyx_GIVEREF(__pyx_t_21);
19951  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
19952  __Pyx_GIVEREF(__pyx_t_22);
19953  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
19954  __Pyx_INCREF(__pyx_slice_);
19955  __Pyx_GIVEREF(__pyx_slice_);
19956  PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_slice_);
19957  __pyx_t_20 = 0;
19958  __pyx_t_21 = 0;
19959  __pyx_t_22 = 0;
19960  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 902, __pyx_L1_error)
19961  __Pyx_GOTREF(__pyx_t_22);
19962  __pyx_t_24 = (__pyx_v_pi * __pyx_v_t);
19963  __pyx_t_25 = (__pyx_v_tForReversal * 2.0);
19964  if (unlikely(__pyx_t_25 == 0)) {
19965  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19966  __PYX_ERR(0, 902, __pyx_L1_error)
19967  }
19968  __pyx_t_21 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_24 / __pyx_t_25)))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 902, __pyx_L1_error)
19969  __Pyx_GOTREF(__pyx_t_21);
19970  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_22, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L1_error)
19971  __Pyx_GOTREF(__pyx_t_20);
19972  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
19973  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
19974  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_23, __pyx_t_20) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)
19975  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
19976  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
19977  }
19978  }
19979  }
19980 
19981  /* "subsurfaceTransportFunctions.pyx":895
19982  * cdef double pi
19983  * pi = M_PI
19984  * if transient == 1: # <<<<<<<<<<<<<<
19985  * for eN in range(x.shape[0]):
19986  * for ebN in range(x.shape[1]):
19987  */
19988  goto __pyx_L3;
19989  }
19990 
19991  /* "subsurfaceTransportFunctions.pyx":904
19992  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19993  * else:
19994  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19995  * for ebN in range(x.shape[1]):
19996  * for k in range(x.shape[2]):
19997  */
19998  /*else*/ {
19999  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
20000  __pyx_t_3 = __pyx_t_2;
20001  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20002  __pyx_v_eN = __pyx_t_4;
20003 
20004  /* "subsurfaceTransportFunctions.pyx":905
20005  * else:
20006  * for eN in range(x.shape[0]):
20007  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20008  * for k in range(x.shape[2]):
20009  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20010  */
20011  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
20012  __pyx_t_6 = __pyx_t_5;
20013  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
20014  __pyx_v_ebN = __pyx_t_7;
20015 
20016  /* "subsurfaceTransportFunctions.pyx":906
20017  * for eN in range(x.shape[0]):
20018  * for ebN in range(x.shape[1]):
20019  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20020  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20021  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20022  */
20023  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
20024  __pyx_t_9 = __pyx_t_8;
20025  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
20026  __pyx_v_k = __pyx_t_10;
20027 
20028  /* "subsurfaceTransportFunctions.pyx":907
20029  * for ebN in range(x.shape[1]):
20030  * for k in range(x.shape[2]):
20031  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
20032  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20033  * v[eN,ebN,k,2]=zVelocity
20034  */
20035  __pyx_t_14 = __pyx_v_eN;
20036  __pyx_t_13 = __pyx_v_ebN;
20037  __pyx_t_12 = __pyx_v_k;
20038  __pyx_t_11 = 1;
20039  __pyx_t_15 = -1;
20040  if (__pyx_t_14 < 0) {
20041  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20042  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
20043  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20044  if (__pyx_t_13 < 0) {
20045  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
20046  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
20047  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20048  if (__pyx_t_12 < 0) {
20049  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
20050  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
20051  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20052  if (__pyx_t_11 < 0) {
20053  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
20054  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
20055  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20056  if (unlikely(__pyx_t_15 != -1)) {
20057  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20058  __PYX_ERR(0, 907, __pyx_L1_error)
20059  }
20060  __pyx_t_16 = __pyx_v_eN;
20061  __pyx_t_17 = __pyx_v_ebN;
20062  __pyx_t_18 = __pyx_v_k;
20063  __pyx_t_19 = 0;
20064  __pyx_t_15 = -1;
20065  if (__pyx_t_16 < 0) {
20066  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
20067  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
20068  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20069  if (__pyx_t_17 < 0) {
20070  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
20071  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
20072  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20073  if (__pyx_t_18 < 0) {
20074  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
20075  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
20076  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20077  if (__pyx_t_19 < 0) {
20078  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
20079  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
20080  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20081  if (unlikely(__pyx_t_15 != -1)) {
20082  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20083  __PYX_ERR(0, 907, __pyx_L1_error)
20084  }
20085  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20086 
20087  /* "subsurfaceTransportFunctions.pyx":908
20088  * for k in range(x.shape[2]):
20089  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20090  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20091  * v[eN,ebN,k,2]=zVelocity
20092  *
20093  */
20094  __pyx_t_11 = __pyx_v_eN;
20095  __pyx_t_12 = __pyx_v_ebN;
20096  __pyx_t_13 = __pyx_v_k;
20097  __pyx_t_14 = 0;
20098  __pyx_t_15 = -1;
20099  if (__pyx_t_11 < 0) {
20100  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20101  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
20102  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20103  if (__pyx_t_12 < 0) {
20104  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20105  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
20106  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20107  if (__pyx_t_13 < 0) {
20108  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20109  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
20110  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20111  if (__pyx_t_14 < 0) {
20112  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
20113  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
20114  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20115  if (unlikely(__pyx_t_15 != -1)) {
20116  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20117  __PYX_ERR(0, 908, __pyx_L1_error)
20118  }
20119  __pyx_t_19 = __pyx_v_eN;
20120  __pyx_t_18 = __pyx_v_ebN;
20121  __pyx_t_17 = __pyx_v_k;
20122  __pyx_t_16 = 1;
20123  __pyx_t_15 = -1;
20124  if (__pyx_t_19 < 0) {
20125  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
20126  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
20127  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20128  if (__pyx_t_18 < 0) {
20129  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20130  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
20131  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20132  if (__pyx_t_17 < 0) {
20133  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
20134  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
20135  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20136  if (__pyx_t_16 < 0) {
20137  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
20138  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
20139  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20140  if (unlikely(__pyx_t_15 != -1)) {
20141  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20142  __PYX_ERR(0, 908, __pyx_L1_error)
20143  }
20144  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides))));
20145 
20146  /* "subsurfaceTransportFunctions.pyx":909
20147  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20148  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20149  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20150  *
20151  * def vortexElementVelocityEval3(double t,
20152  */
20153  __pyx_t_14 = __pyx_v_eN;
20154  __pyx_t_13 = __pyx_v_ebN;
20155  __pyx_t_12 = __pyx_v_k;
20156  __pyx_t_11 = 2;
20157  __pyx_t_15 = -1;
20158  if (__pyx_t_14 < 0) {
20159  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
20160  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
20161  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20162  if (__pyx_t_13 < 0) {
20163  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
20164  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
20165  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20166  if (__pyx_t_12 < 0) {
20167  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
20168  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
20169  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20170  if (__pyx_t_11 < 0) {
20171  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[3].shape;
20172  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
20173  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20174  if (unlikely(__pyx_t_15 != -1)) {
20175  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20176  __PYX_ERR(0, 909, __pyx_L1_error)
20177  }
20178  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20179  }
20180  }
20181  }
20182  }
20183  __pyx_L3:;
20184 
20185  /* "subsurfaceTransportFunctions.pyx":884
20186  * v[eN,k,2]=zVelocity
20187  *
20188  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
20189  * double t,
20190  * double tForReversal,
20191  */
20192 
20193  /* function exit code */
20194  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20195  goto __pyx_L0;
20196  __pyx_L1_error:;
20197  __Pyx_XDECREF(__pyx_t_20);
20198  __Pyx_XDECREF(__pyx_t_21);
20199  __Pyx_XDECREF(__pyx_t_22);
20200  __Pyx_XDECREF(__pyx_t_23);
20201  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20202  __Pyx_PyThreadState_declare
20203  __Pyx_PyThreadState_assign
20204  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20205  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20206  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20207  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20208  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20209  __pyx_r = NULL;
20210  goto __pyx_L2;
20211  __pyx_L0:;
20212  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20213  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20214  __pyx_L2:;
20215  __Pyx_XGIVEREF(__pyx_r);
20216  __Pyx_RefNannyFinishContext();
20217  return __pyx_r;
20218 }
20219 
20220 /* "subsurfaceTransportFunctions.pyx":911
20221  * v[eN,ebN,k,2]=zVelocity
20222  *
20223  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20224  * numpy.ndarray[DTYPE_t,ndim=3] x,
20225  * numpy.ndarray[DTYPE_t,ndim=3] v):
20226  */
20227 
20228 /* Python wrapper */
20229 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20230 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
20231 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20232  double __pyx_v_t;
20233  PyArrayObject *__pyx_v_x = 0;
20234  PyArrayObject *__pyx_v_v = 0;
20235  int __pyx_lineno = 0;
20236  const char *__pyx_filename = NULL;
20237  int __pyx_clineno = 0;
20238  PyObject *__pyx_r = 0;
20239  __Pyx_RefNannyDeclarations
20240  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
20241  {
20242  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20243  PyObject* values[3] = {0,0,0};
20244  if (unlikely(__pyx_kwds)) {
20245  Py_ssize_t kw_args;
20246  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20247  switch (pos_args) {
20248  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20249  CYTHON_FALLTHROUGH;
20250  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20251  CYTHON_FALLTHROUGH;
20252  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20253  CYTHON_FALLTHROUGH;
20254  case 0: break;
20255  default: goto __pyx_L5_argtuple_error;
20256  }
20257  kw_args = PyDict_Size(__pyx_kwds);
20258  switch (pos_args) {
20259  case 0:
20260  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20261  else goto __pyx_L5_argtuple_error;
20262  CYTHON_FALLTHROUGH;
20263  case 1:
20264  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20265  else {
20266  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
20267  }
20268  CYTHON_FALLTHROUGH;
20269  case 2:
20270  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20271  else {
20272  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
20273  }
20274  }
20275  if (unlikely(kw_args > 0)) {
20276  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
20277  }
20278  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20279  goto __pyx_L5_argtuple_error;
20280  } else {
20281  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20282  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20283  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20284  }
20285  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L3_error)
20286  __pyx_v_x = ((PyArrayObject *)values[1]);
20287  __pyx_v_v = ((PyArrayObject *)values[2]);
20288  }
20289  goto __pyx_L4_argument_unpacking_done;
20290  __pyx_L5_argtuple_error:;
20291  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
20292  __pyx_L3_error:;
20293  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20294  __Pyx_RefNannyFinishContext();
20295  return NULL;
20296  __pyx_L4_argument_unpacking_done:;
20297  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 912, __pyx_L1_error)
20298  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 913, __pyx_L1_error)
20299  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20300 
20301  /* function exit code */
20302  goto __pyx_L0;
20303  __pyx_L1_error:;
20304  __pyx_r = NULL;
20305  __pyx_L0:;
20306  __Pyx_RefNannyFinishContext();
20307  return __pyx_r;
20308 }
20309 
20310 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20311  int __pyx_v_eN;
20312  int __pyx_v_k;
20313  double __pyx_v_pi;
20314  double __pyx_v_one8;
20315  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20316  __Pyx_Buffer __pyx_pybuffer_v;
20317  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20318  __Pyx_Buffer __pyx_pybuffer_x;
20319  PyObject *__pyx_r = NULL;
20320  __Pyx_RefNannyDeclarations
20321  npy_intp __pyx_t_1;
20322  npy_intp __pyx_t_2;
20323  int __pyx_t_3;
20324  npy_intp __pyx_t_4;
20325  npy_intp __pyx_t_5;
20326  int __pyx_t_6;
20327  Py_ssize_t __pyx_t_7;
20328  Py_ssize_t __pyx_t_8;
20329  Py_ssize_t __pyx_t_9;
20330  int __pyx_t_10;
20331  Py_ssize_t __pyx_t_11;
20332  Py_ssize_t __pyx_t_12;
20333  Py_ssize_t __pyx_t_13;
20334  Py_ssize_t __pyx_t_14;
20335  Py_ssize_t __pyx_t_15;
20336  Py_ssize_t __pyx_t_16;
20337  Py_ssize_t __pyx_t_17;
20338  Py_ssize_t __pyx_t_18;
20339  Py_ssize_t __pyx_t_19;
20340  int __pyx_lineno = 0;
20341  const char *__pyx_filename = NULL;
20342  int __pyx_clineno = 0;
20343  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
20344  __pyx_pybuffer_x.pybuffer.buf = NULL;
20345  __pyx_pybuffer_x.refcount = 0;
20346  __pyx_pybuffernd_x.data = NULL;
20347  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20348  __pyx_pybuffer_v.pybuffer.buf = NULL;
20349  __pyx_pybuffer_v.refcount = 0;
20350  __pyx_pybuffernd_v.data = NULL;
20351  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20352  {
20353  __Pyx_BufFmt_StackElem __pyx_stack[1];
20354  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20355  }
20356  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
20357  {
20358  __Pyx_BufFmt_StackElem __pyx_stack[1];
20359  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20360  }
20361  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
20362 
20363  /* "subsurfaceTransportFunctions.pyx":916
20364  * cdef int eN,k
20365  * cdef double pi,one8
20366  * pi = M_PI # <<<<<<<<<<<<<<
20367  * one8 = 1.0/8.0
20368  * for eN in range(x.shape[0]):
20369  */
20370  __pyx_v_pi = M_PI;
20371 
20372  /* "subsurfaceTransportFunctions.pyx":917
20373  * cdef double pi,one8
20374  * pi = M_PI
20375  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20376  * for eN in range(x.shape[0]):
20377  * for k in range(x.shape[1]):
20378  */
20379  __pyx_v_one8 = (1.0 / 8.0);
20380 
20381  /* "subsurfaceTransportFunctions.pyx":918
20382  * pi = M_PI
20383  * one8 = 1.0/8.0
20384  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20385  * for k in range(x.shape[1]):
20386  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20387  */
20388  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20389  __pyx_t_2 = __pyx_t_1;
20390  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20391  __pyx_v_eN = __pyx_t_3;
20392 
20393  /* "subsurfaceTransportFunctions.pyx":919
20394  * one8 = 1.0/8.0
20395  * for eN in range(x.shape[0]):
20396  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
20397  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20398  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20399  */
20400  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20401  __pyx_t_5 = __pyx_t_4;
20402  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20403  __pyx_v_k = __pyx_t_6;
20404 
20405  /* "subsurfaceTransportFunctions.pyx":920
20406  * for eN in range(x.shape[0]):
20407  * for k in range(x.shape[1]):
20408  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
20409  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20410  *
20411  */
20412  __pyx_t_7 = __pyx_v_eN;
20413  __pyx_t_8 = __pyx_v_k;
20414  __pyx_t_9 = 1;
20415  __pyx_t_10 = -1;
20416  if (__pyx_t_7 < 0) {
20417  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
20418  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
20419  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20420  if (__pyx_t_8 < 0) {
20421  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20422  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20423  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20424  if (__pyx_t_9 < 0) {
20425  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
20426  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 2;
20427  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20428  if (unlikely(__pyx_t_10 != -1)) {
20429  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20430  __PYX_ERR(0, 920, __pyx_L1_error)
20431  }
20432  __pyx_t_11 = __pyx_v_eN;
20433  __pyx_t_12 = __pyx_v_k;
20434  __pyx_t_13 = 0;
20435  __pyx_t_10 = -1;
20436  if (__pyx_t_11 < 0) {
20437  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20438  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
20439  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20440  if (__pyx_t_12 < 0) {
20441  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20442  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20443  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20444  if (__pyx_t_13 < 0) {
20445  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20446  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 2;
20447  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20448  if (unlikely(__pyx_t_10 != -1)) {
20449  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20450  __PYX_ERR(0, 920, __pyx_L1_error)
20451  }
20452  __pyx_t_14 = __pyx_v_eN;
20453  __pyx_t_15 = __pyx_v_k;
20454  __pyx_t_16 = 0;
20455  __pyx_t_10 = -1;
20456  if (__pyx_t_14 < 0) {
20457  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20458  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
20459  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20460  if (__pyx_t_15 < 0) {
20461  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20462  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20463  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20464  if (__pyx_t_16 < 0) {
20465  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20466  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 2;
20467  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20468  if (unlikely(__pyx_t_10 != -1)) {
20469  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20470  __PYX_ERR(0, 920, __pyx_L1_error)
20471  }
20472  __pyx_t_17 = __pyx_v_eN;
20473  __pyx_t_18 = __pyx_v_k;
20474  __pyx_t_19 = 0;
20475  __pyx_t_10 = -1;
20476  if (__pyx_t_17 < 0) {
20477  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[0].shape;
20478  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
20479  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20480  if (__pyx_t_18 < 0) {
20481  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20482  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20483  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20484  if (__pyx_t_19 < 0) {
20485  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[2].shape;
20486  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 2;
20487  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20488  if (unlikely(__pyx_t_10 != -1)) {
20489  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20490  __PYX_ERR(0, 920, __pyx_L1_error)
20491  }
20492  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides)))));
20493 
20494  /* "subsurfaceTransportFunctions.pyx":921
20495  * for k in range(x.shape[1]):
20496  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20497  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
20498  *
20499  *
20500  */
20501  __pyx_t_16 = __pyx_v_eN;
20502  __pyx_t_15 = __pyx_v_k;
20503  __pyx_t_14 = 0;
20504  __pyx_t_10 = -1;
20505  if (__pyx_t_16 < 0) {
20506  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[0].shape;
20507  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
20508  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20509  if (__pyx_t_15 < 0) {
20510  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20511  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20512  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20513  if (__pyx_t_14 < 0) {
20514  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
20515  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 2;
20516  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20517  if (unlikely(__pyx_t_10 != -1)) {
20518  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20519  __PYX_ERR(0, 921, __pyx_L1_error)
20520  }
20521  __pyx_t_13 = __pyx_v_eN;
20522  __pyx_t_12 = __pyx_v_k;
20523  __pyx_t_11 = 1;
20524  __pyx_t_10 = -1;
20525  if (__pyx_t_13 < 0) {
20526  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
20527  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0;
20528  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20529  if (__pyx_t_12 < 0) {
20530  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20531  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20532  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20533  if (__pyx_t_11 < 0) {
20534  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
20535  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 2;
20536  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20537  if (unlikely(__pyx_t_10 != -1)) {
20538  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20539  __PYX_ERR(0, 921, __pyx_L1_error)
20540  }
20541  __pyx_t_9 = __pyx_v_eN;
20542  __pyx_t_8 = __pyx_v_k;
20543  __pyx_t_7 = 1;
20544  __pyx_t_10 = -1;
20545  if (__pyx_t_9 < 0) {
20546  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[0].shape;
20547  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
20548  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20549  if (__pyx_t_8 < 0) {
20550  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20551  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20552  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20553  if (__pyx_t_7 < 0) {
20554  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[2].shape;
20555  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 2;
20556  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20557  if (unlikely(__pyx_t_10 != -1)) {
20558  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20559  __PYX_ERR(0, 921, __pyx_L1_error)
20560  }
20561  __pyx_t_19 = __pyx_v_eN;
20562  __pyx_t_18 = __pyx_v_k;
20563  __pyx_t_17 = 1;
20564  __pyx_t_10 = -1;
20565  if (__pyx_t_19 < 0) {
20566  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
20567  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
20568  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20569  if (__pyx_t_18 < 0) {
20570  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20571  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20572  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20573  if (__pyx_t_17 < 0) {
20574  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
20575  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 2;
20576  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20577  if (unlikely(__pyx_t_10 != -1)) {
20578  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20579  __PYX_ERR(0, 921, __pyx_L1_error)
20580  }
20581  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[2].strides)))));
20582  }
20583  }
20584 
20585  /* "subsurfaceTransportFunctions.pyx":911
20586  * v[eN,ebN,k,2]=zVelocity
20587  *
20588  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20589  * numpy.ndarray[DTYPE_t,ndim=3] x,
20590  * numpy.ndarray[DTYPE_t,ndim=3] v):
20591  */
20592 
20593  /* function exit code */
20594  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20595  goto __pyx_L0;
20596  __pyx_L1_error:;
20597  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20598  __Pyx_PyThreadState_declare
20599  __Pyx_PyThreadState_assign
20600  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20601  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20602  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20603  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20604  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20605  __pyx_r = NULL;
20606  goto __pyx_L2;
20607  __pyx_L0:;
20608  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20609  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20610  __pyx_L2:;
20611  __Pyx_XGIVEREF(__pyx_r);
20612  __Pyx_RefNannyFinishContext();
20613  return __pyx_r;
20614 }
20615 
20616 /* "subsurfaceTransportFunctions.pyx":924
20617  *
20618  *
20619  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20620  * numpy.ndarray[DTYPE_t,ndim=4] x,
20621  * numpy.ndarray[DTYPE_t,ndim=4] v):
20622  */
20623 
20624 /* Python wrapper */
20625 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20626 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
20627 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20628  double __pyx_v_t;
20629  PyArrayObject *__pyx_v_x = 0;
20630  PyArrayObject *__pyx_v_v = 0;
20631  int __pyx_lineno = 0;
20632  const char *__pyx_filename = NULL;
20633  int __pyx_clineno = 0;
20634  PyObject *__pyx_r = 0;
20635  __Pyx_RefNannyDeclarations
20636  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
20637  {
20638  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20639  PyObject* values[3] = {0,0,0};
20640  if (unlikely(__pyx_kwds)) {
20641  Py_ssize_t kw_args;
20642  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20643  switch (pos_args) {
20644  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20645  CYTHON_FALLTHROUGH;
20646  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20647  CYTHON_FALLTHROUGH;
20648  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20649  CYTHON_FALLTHROUGH;
20650  case 0: break;
20651  default: goto __pyx_L5_argtuple_error;
20652  }
20653  kw_args = PyDict_Size(__pyx_kwds);
20654  switch (pos_args) {
20655  case 0:
20656  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20657  else goto __pyx_L5_argtuple_error;
20658  CYTHON_FALLTHROUGH;
20659  case 1:
20660  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20661  else {
20662  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); __PYX_ERR(0, 924, __pyx_L3_error)
20663  }
20664  CYTHON_FALLTHROUGH;
20665  case 2:
20666  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20667  else {
20668  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); __PYX_ERR(0, 924, __pyx_L3_error)
20669  }
20670  }
20671  if (unlikely(kw_args > 0)) {
20672  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
20673  }
20674  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20675  goto __pyx_L5_argtuple_error;
20676  } else {
20677  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20678  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20679  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20680  }
20681  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error)
20682  __pyx_v_x = ((PyArrayObject *)values[1]);
20683  __pyx_v_v = ((PyArrayObject *)values[2]);
20684  }
20685  goto __pyx_L4_argument_unpacking_done;
20686  __pyx_L5_argtuple_error:;
20687  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
20688  __pyx_L3_error:;
20689  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20690  __Pyx_RefNannyFinishContext();
20691  return NULL;
20692  __pyx_L4_argument_unpacking_done:;
20693  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
20694  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 926, __pyx_L1_error)
20695  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20696 
20697  /* function exit code */
20698  goto __pyx_L0;
20699  __pyx_L1_error:;
20700  __pyx_r = NULL;
20701  __pyx_L0:;
20702  __Pyx_RefNannyFinishContext();
20703  return __pyx_r;
20704 }
20705 
20706 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20707  int __pyx_v_eN;
20708  int __pyx_v_k;
20709  int __pyx_v_ebN;
20710  double __pyx_v_pi;
20711  double __pyx_v_one8;
20712  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20713  __Pyx_Buffer __pyx_pybuffer_v;
20714  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20715  __Pyx_Buffer __pyx_pybuffer_x;
20716  PyObject *__pyx_r = NULL;
20717  __Pyx_RefNannyDeclarations
20718  npy_intp __pyx_t_1;
20719  npy_intp __pyx_t_2;
20720  int __pyx_t_3;
20721  npy_intp __pyx_t_4;
20722  npy_intp __pyx_t_5;
20723  int __pyx_t_6;
20724  npy_intp __pyx_t_7;
20725  npy_intp __pyx_t_8;
20726  int __pyx_t_9;
20727  Py_ssize_t __pyx_t_10;
20728  Py_ssize_t __pyx_t_11;
20729  Py_ssize_t __pyx_t_12;
20730  Py_ssize_t __pyx_t_13;
20731  int __pyx_t_14;
20732  Py_ssize_t __pyx_t_15;
20733  Py_ssize_t __pyx_t_16;
20734  Py_ssize_t __pyx_t_17;
20735  Py_ssize_t __pyx_t_18;
20736  Py_ssize_t __pyx_t_19;
20737  Py_ssize_t __pyx_t_20;
20738  Py_ssize_t __pyx_t_21;
20739  Py_ssize_t __pyx_t_22;
20740  Py_ssize_t __pyx_t_23;
20741  Py_ssize_t __pyx_t_24;
20742  Py_ssize_t __pyx_t_25;
20743  Py_ssize_t __pyx_t_26;
20744  int __pyx_lineno = 0;
20745  const char *__pyx_filename = NULL;
20746  int __pyx_clineno = 0;
20747  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
20748  __pyx_pybuffer_x.pybuffer.buf = NULL;
20749  __pyx_pybuffer_x.refcount = 0;
20750  __pyx_pybuffernd_x.data = NULL;
20751  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20752  __pyx_pybuffer_v.pybuffer.buf = NULL;
20753  __pyx_pybuffer_v.refcount = 0;
20754  __pyx_pybuffernd_v.data = NULL;
20755  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20756  {
20757  __Pyx_BufFmt_StackElem __pyx_stack[1];
20758  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20759  }
20760  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
20761  {
20762  __Pyx_BufFmt_StackElem __pyx_stack[1];
20763  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20764  }
20765  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
20766 
20767  /* "subsurfaceTransportFunctions.pyx":929
20768  * cdef int eN,k,ebN
20769  * cdef double pi,one8
20770  * pi = M_PI # <<<<<<<<<<<<<<
20771  * one8 = 1.0/8.0
20772  * for eN in range(x.shape[0]):
20773  */
20774  __pyx_v_pi = M_PI;
20775 
20776  /* "subsurfaceTransportFunctions.pyx":930
20777  * cdef double pi,one8
20778  * pi = M_PI
20779  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20780  * for eN in range(x.shape[0]):
20781  * for ebN in range(x.shape[1]):
20782  */
20783  __pyx_v_one8 = (1.0 / 8.0);
20784 
20785  /* "subsurfaceTransportFunctions.pyx":931
20786  * pi = M_PI
20787  * one8 = 1.0/8.0
20788  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20789  * for ebN in range(x.shape[1]):
20790  * for k in range(x.shape[2]):
20791  */
20792  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20793  __pyx_t_2 = __pyx_t_1;
20794  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20795  __pyx_v_eN = __pyx_t_3;
20796 
20797  /* "subsurfaceTransportFunctions.pyx":932
20798  * one8 = 1.0/8.0
20799  * for eN in range(x.shape[0]):
20800  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20801  * for k in range(x.shape[2]):
20802  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20803  */
20804  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20805  __pyx_t_5 = __pyx_t_4;
20806  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20807  __pyx_v_ebN = __pyx_t_6;
20808 
20809  /* "subsurfaceTransportFunctions.pyx":933
20810  * for eN in range(x.shape[0]):
20811  * for ebN in range(x.shape[1]):
20812  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20813  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20814  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20815  */
20816  __pyx_t_7 = (__pyx_v_x->dimensions[2]);
20817  __pyx_t_8 = __pyx_t_7;
20818  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
20819  __pyx_v_k = __pyx_t_9;
20820 
20821  /* "subsurfaceTransportFunctions.pyx":934
20822  * for ebN in range(x.shape[1]):
20823  * for k in range(x.shape[2]):
20824  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
20825  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20826  *
20827  */
20828  __pyx_t_10 = __pyx_v_eN;
20829  __pyx_t_11 = __pyx_v_ebN;
20830  __pyx_t_12 = __pyx_v_k;
20831  __pyx_t_13 = 1;
20832  __pyx_t_14 = -1;
20833  if (__pyx_t_10 < 0) {
20834  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
20835  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 0;
20836  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20837  if (__pyx_t_11 < 0) {
20838  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[1].shape;
20839  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 1;
20840  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20841  if (__pyx_t_12 < 0) {
20842  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
20843  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 2;
20844  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20845  if (__pyx_t_13 < 0) {
20846  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[3].shape;
20847  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 3;
20848  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20849  if (unlikely(__pyx_t_14 != -1)) {
20850  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20851  __PYX_ERR(0, 934, __pyx_L1_error)
20852  }
20853  __pyx_t_15 = __pyx_v_eN;
20854  __pyx_t_16 = __pyx_v_ebN;
20855  __pyx_t_17 = __pyx_v_k;
20856  __pyx_t_18 = 0;
20857  __pyx_t_14 = -1;
20858  if (__pyx_t_15 < 0) {
20859  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
20860  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0;
20861  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20862  if (__pyx_t_16 < 0) {
20863  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
20864  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
20865  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20866  if (__pyx_t_17 < 0) {
20867  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
20868  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 2;
20869  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20870  if (__pyx_t_18 < 0) {
20871  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[3].shape;
20872  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 3;
20873  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20874  if (unlikely(__pyx_t_14 != -1)) {
20875  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20876  __PYX_ERR(0, 934, __pyx_L1_error)
20877  }
20878  __pyx_t_19 = __pyx_v_eN;
20879  __pyx_t_20 = __pyx_v_ebN;
20880  __pyx_t_21 = __pyx_v_k;
20881  __pyx_t_22 = 0;
20882  __pyx_t_14 = -1;
20883  if (__pyx_t_19 < 0) {
20884  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[0].shape;
20885  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 0;
20886  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20887  if (__pyx_t_20 < 0) {
20888  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[1].shape;
20889  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 1;
20890  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20891  if (__pyx_t_21 < 0) {
20892  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[2].shape;
20893  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
20894  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20895  if (__pyx_t_22 < 0) {
20896  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[3].shape;
20897  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 3;
20898  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20899  if (unlikely(__pyx_t_14 != -1)) {
20900  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20901  __PYX_ERR(0, 934, __pyx_L1_error)
20902  }
20903  __pyx_t_23 = __pyx_v_eN;
20904  __pyx_t_24 = __pyx_v_ebN;
20905  __pyx_t_25 = __pyx_v_k;
20906  __pyx_t_26 = 0;
20907  __pyx_t_14 = -1;
20908  if (__pyx_t_23 < 0) {
20909  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[0].shape;
20910  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
20911  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
20912  if (__pyx_t_24 < 0) {
20913  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[1].shape;
20914  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
20915  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
20916  if (__pyx_t_25 < 0) {
20917  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[2].shape;
20918  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
20919  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
20920  if (__pyx_t_26 < 0) {
20921  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[3].shape;
20922  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 3;
20923  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
20924  if (unlikely(__pyx_t_14 != -1)) {
20925  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20926  __PYX_ERR(0, 934, __pyx_L1_error)
20927  }
20928  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[3].strides)))));
20929 
20930  /* "subsurfaceTransportFunctions.pyx":935
20931  * for k in range(x.shape[2]):
20932  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20933  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
20934  *
20935  *
20936  */
20937  __pyx_t_22 = __pyx_v_eN;
20938  __pyx_t_21 = __pyx_v_ebN;
20939  __pyx_t_20 = __pyx_v_k;
20940  __pyx_t_19 = 0;
20941  __pyx_t_14 = -1;
20942  if (__pyx_t_22 < 0) {
20943  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[0].shape;
20944  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 0;
20945  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20946  if (__pyx_t_21 < 0) {
20947  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
20948  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 1;
20949  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20950  if (__pyx_t_20 < 0) {
20951  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[2].shape;
20952  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 2;
20953  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20954  if (__pyx_t_19 < 0) {
20955  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[3].shape;
20956  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 3;
20957  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20958  if (unlikely(__pyx_t_14 != -1)) {
20959  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20960  __PYX_ERR(0, 935, __pyx_L1_error)
20961  }
20962  __pyx_t_18 = __pyx_v_eN;
20963  __pyx_t_17 = __pyx_v_ebN;
20964  __pyx_t_16 = __pyx_v_k;
20965  __pyx_t_15 = 1;
20966  __pyx_t_14 = -1;
20967  if (__pyx_t_18 < 0) {
20968  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[0].shape;
20969  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 0;
20970  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20971  if (__pyx_t_17 < 0) {
20972  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[1].shape;
20973  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 1;
20974  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20975  if (__pyx_t_16 < 0) {
20976  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20977  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 2;
20978  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20979  if (__pyx_t_15 < 0) {
20980  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[3].shape;
20981  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 3;
20982  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20983  if (unlikely(__pyx_t_14 != -1)) {
20984  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20985  __PYX_ERR(0, 935, __pyx_L1_error)
20986  }
20987  __pyx_t_13 = __pyx_v_eN;
20988  __pyx_t_12 = __pyx_v_ebN;
20989  __pyx_t_11 = __pyx_v_k;
20990  __pyx_t_10 = 1;
20991  __pyx_t_14 = -1;
20992  if (__pyx_t_13 < 0) {
20993  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
20994  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
20995  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20996  if (__pyx_t_12 < 0) {
20997  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20998  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 1;
20999  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21000  if (__pyx_t_11 < 0) {
21001  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
21002  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 2;
21003  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21004  if (__pyx_t_10 < 0) {
21005  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[3].shape;
21006  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 3;
21007  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21008  if (unlikely(__pyx_t_14 != -1)) {
21009  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21010  __PYX_ERR(0, 935, __pyx_L1_error)
21011  }
21012  __pyx_t_26 = __pyx_v_eN;
21013  __pyx_t_25 = __pyx_v_ebN;
21014  __pyx_t_24 = __pyx_v_k;
21015  __pyx_t_23 = 1;
21016  __pyx_t_14 = -1;
21017  if (__pyx_t_26 < 0) {
21018  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[0].shape;
21019  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 0;
21020  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21021  if (__pyx_t_25 < 0) {
21022  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
21023  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 1;
21024  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21025  if (__pyx_t_24 < 0) {
21026  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[2].shape;
21027  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 2;
21028  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21029  if (__pyx_t_23 < 0) {
21030  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[3].shape;
21031  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 3;
21032  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21033  if (unlikely(__pyx_t_14 != -1)) {
21034  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21035  __PYX_ERR(0, 935, __pyx_L1_error)
21036  }
21037  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[3].strides)))));
21038  }
21039  }
21040  }
21041 
21042  /* "subsurfaceTransportFunctions.pyx":924
21043  *
21044  *
21045  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
21046  * numpy.ndarray[DTYPE_t,ndim=4] x,
21047  * numpy.ndarray[DTYPE_t,ndim=4] v):
21048  */
21049 
21050  /* function exit code */
21051  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21052  goto __pyx_L0;
21053  __pyx_L1_error:;
21054  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21055  __Pyx_PyThreadState_declare
21056  __Pyx_PyThreadState_assign
21057  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21058  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21059  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21060  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21061  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21062  __pyx_r = NULL;
21063  goto __pyx_L2;
21064  __pyx_L0:;
21065  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21066  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21067  __pyx_L2:;
21068  __Pyx_XGIVEREF(__pyx_r);
21069  __Pyx_RefNannyFinishContext();
21070  return __pyx_r;
21071 }
21072 
21073 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":735
21074  * ctypedef npy_cdouble complex_t
21075  *
21076  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21077  * return PyArray_MultiIterNew(1, <void*>a)
21078  *
21079  */
21080 
21081 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
21082  PyObject *__pyx_r = NULL;
21083  __Pyx_RefNannyDeclarations
21084  PyObject *__pyx_t_1 = NULL;
21085  int __pyx_lineno = 0;
21086  const char *__pyx_filename = NULL;
21087  int __pyx_clineno = 0;
21088  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
21089 
21090  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":736
21091  *
21092  * cdef inline object PyArray_MultiIterNew1(a):
21093  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
21094  *
21095  * cdef inline object PyArray_MultiIterNew2(a, b):
21096  */
21097  __Pyx_XDECREF(__pyx_r);
21098  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
21099  __Pyx_GOTREF(__pyx_t_1);
21100  __pyx_r = __pyx_t_1;
21101  __pyx_t_1 = 0;
21102  goto __pyx_L0;
21103 
21104  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":735
21105  * ctypedef npy_cdouble complex_t
21106  *
21107  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21108  * return PyArray_MultiIterNew(1, <void*>a)
21109  *
21110  */
21111 
21112  /* function exit code */
21113  __pyx_L1_error:;
21114  __Pyx_XDECREF(__pyx_t_1);
21115  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
21116  __pyx_r = 0;
21117  __pyx_L0:;
21118  __Pyx_XGIVEREF(__pyx_r);
21119  __Pyx_RefNannyFinishContext();
21120  return __pyx_r;
21121 }
21122 
21123 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":738
21124  * return PyArray_MultiIterNew(1, <void*>a)
21125  *
21126  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21127  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21128  *
21129  */
21130 
21131 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
21132  PyObject *__pyx_r = NULL;
21133  __Pyx_RefNannyDeclarations
21134  PyObject *__pyx_t_1 = NULL;
21135  int __pyx_lineno = 0;
21136  const char *__pyx_filename = NULL;
21137  int __pyx_clineno = 0;
21138  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
21139 
21140  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":739
21141  *
21142  * cdef inline object PyArray_MultiIterNew2(a, b):
21143  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
21144  *
21145  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21146  */
21147  __Pyx_XDECREF(__pyx_r);
21148  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
21149  __Pyx_GOTREF(__pyx_t_1);
21150  __pyx_r = __pyx_t_1;
21151  __pyx_t_1 = 0;
21152  goto __pyx_L0;
21153 
21154  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":738
21155  * return PyArray_MultiIterNew(1, <void*>a)
21156  *
21157  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21158  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21159  *
21160  */
21161 
21162  /* function exit code */
21163  __pyx_L1_error:;
21164  __Pyx_XDECREF(__pyx_t_1);
21165  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
21166  __pyx_r = 0;
21167  __pyx_L0:;
21168  __Pyx_XGIVEREF(__pyx_r);
21169  __Pyx_RefNannyFinishContext();
21170  return __pyx_r;
21171 }
21172 
21173 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":741
21174  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21175  *
21176  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21177  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21178  *
21179  */
21180 
21181 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
21182  PyObject *__pyx_r = NULL;
21183  __Pyx_RefNannyDeclarations
21184  PyObject *__pyx_t_1 = NULL;
21185  int __pyx_lineno = 0;
21186  const char *__pyx_filename = NULL;
21187  int __pyx_clineno = 0;
21188  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
21189 
21190  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":742
21191  *
21192  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21193  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
21194  *
21195  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21196  */
21197  __Pyx_XDECREF(__pyx_r);
21198  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
21199  __Pyx_GOTREF(__pyx_t_1);
21200  __pyx_r = __pyx_t_1;
21201  __pyx_t_1 = 0;
21202  goto __pyx_L0;
21203 
21204  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":741
21205  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21206  *
21207  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21208  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21209  *
21210  */
21211 
21212  /* function exit code */
21213  __pyx_L1_error:;
21214  __Pyx_XDECREF(__pyx_t_1);
21215  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
21216  __pyx_r = 0;
21217  __pyx_L0:;
21218  __Pyx_XGIVEREF(__pyx_r);
21219  __Pyx_RefNannyFinishContext();
21220  return __pyx_r;
21221 }
21222 
21223 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":744
21224  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21225  *
21226  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21227  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21228  *
21229  */
21230 
21231 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
21232  PyObject *__pyx_r = NULL;
21233  __Pyx_RefNannyDeclarations
21234  PyObject *__pyx_t_1 = NULL;
21235  int __pyx_lineno = 0;
21236  const char *__pyx_filename = NULL;
21237  int __pyx_clineno = 0;
21238  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
21239 
21240  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":745
21241  *
21242  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21243  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
21244  *
21245  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21246  */
21247  __Pyx_XDECREF(__pyx_r);
21248  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
21249  __Pyx_GOTREF(__pyx_t_1);
21250  __pyx_r = __pyx_t_1;
21251  __pyx_t_1 = 0;
21252  goto __pyx_L0;
21253 
21254  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":744
21255  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21256  *
21257  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21258  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21259  *
21260  */
21261 
21262  /* function exit code */
21263  __pyx_L1_error:;
21264  __Pyx_XDECREF(__pyx_t_1);
21265  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21266  __pyx_r = 0;
21267  __pyx_L0:;
21268  __Pyx_XGIVEREF(__pyx_r);
21269  __Pyx_RefNannyFinishContext();
21270  return __pyx_r;
21271 }
21272 
21273 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":747
21274  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21275  *
21276  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21277  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21278  *
21279  */
21280 
21281 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
21282  PyObject *__pyx_r = NULL;
21283  __Pyx_RefNannyDeclarations
21284  PyObject *__pyx_t_1 = NULL;
21285  int __pyx_lineno = 0;
21286  const char *__pyx_filename = NULL;
21287  int __pyx_clineno = 0;
21288  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
21289 
21290  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":748
21291  *
21292  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21293  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
21294  *
21295  * cdef inline tuple PyDataType_SHAPE(dtype d):
21296  */
21297  __Pyx_XDECREF(__pyx_r);
21298  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
21299  __Pyx_GOTREF(__pyx_t_1);
21300  __pyx_r = __pyx_t_1;
21301  __pyx_t_1 = 0;
21302  goto __pyx_L0;
21303 
21304  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":747
21305  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21306  *
21307  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21308  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21309  *
21310  */
21311 
21312  /* function exit code */
21313  __pyx_L1_error:;
21314  __Pyx_XDECREF(__pyx_t_1);
21315  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
21316  __pyx_r = 0;
21317  __pyx_L0:;
21318  __Pyx_XGIVEREF(__pyx_r);
21319  __Pyx_RefNannyFinishContext();
21320  return __pyx_r;
21321 }
21322 
21323 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":750
21324  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21325  *
21326  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
21327  * if PyDataType_HASSUBARRAY(d):
21328  * return <tuple>d.subarray.shape
21329  */
21330 
21331 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
21332  PyObject *__pyx_r = NULL;
21333  __Pyx_RefNannyDeclarations
21334  int __pyx_t_1;
21335  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
21336 
21337  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":751
21338  *
21339  * cdef inline tuple PyDataType_SHAPE(dtype d):
21340  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
21341  * return <tuple>d.subarray.shape
21342  * else:
21343  */
21344  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
21345  if (__pyx_t_1) {
21346 
21347  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":752
21348  * cdef inline tuple PyDataType_SHAPE(dtype d):
21349  * if PyDataType_HASSUBARRAY(d):
21350  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
21351  * else:
21352  * return ()
21353  */
21354  __Pyx_XDECREF(__pyx_r);
21355  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
21356  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
21357  goto __pyx_L0;
21358 
21359  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":751
21360  *
21361  * cdef inline tuple PyDataType_SHAPE(dtype d):
21362  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
21363  * return <tuple>d.subarray.shape
21364  * else:
21365  */
21366  }
21367 
21368  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":754
21369  * return <tuple>d.subarray.shape
21370  * else:
21371  * return () # <<<<<<<<<<<<<<
21372  *
21373  *
21374  */
21375  /*else*/ {
21376  __Pyx_XDECREF(__pyx_r);
21377  __Pyx_INCREF(__pyx_empty_tuple);
21378  __pyx_r = __pyx_empty_tuple;
21379  goto __pyx_L0;
21380  }
21381 
21382  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":750
21383  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21384  *
21385  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
21386  * if PyDataType_HASSUBARRAY(d):
21387  * return <tuple>d.subarray.shape
21388  */
21389 
21390  /* function exit code */
21391  __pyx_L0:;
21392  __Pyx_XGIVEREF(__pyx_r);
21393  __Pyx_RefNannyFinishContext();
21394  return __pyx_r;
21395 }
21396 
21397 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":929
21398  * int _import_umath() except -1
21399  *
21400  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
21401  * Py_INCREF(base) # important to do this before stealing the reference below!
21402  * PyArray_SetBaseObject(arr, base)
21403  */
21404 
21405 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
21406  __Pyx_RefNannyDeclarations
21407  __Pyx_RefNannySetupContext("set_array_base", 0);
21408 
21409  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":930
21410  *
21411  * cdef inline void set_array_base(ndarray arr, object base):
21412  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
21413  * PyArray_SetBaseObject(arr, base)
21414  *
21415  */
21416  Py_INCREF(__pyx_v_base);
21417 
21418  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":931
21419  * cdef inline void set_array_base(ndarray arr, object base):
21420  * Py_INCREF(base) # important to do this before stealing the reference below!
21421  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
21422  *
21423  * cdef inline object get_array_base(ndarray arr):
21424  */
21425  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
21426 
21427  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":929
21428  * int _import_umath() except -1
21429  *
21430  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
21431  * Py_INCREF(base) # important to do this before stealing the reference below!
21432  * PyArray_SetBaseObject(arr, base)
21433  */
21434 
21435  /* function exit code */
21436  __Pyx_RefNannyFinishContext();
21437 }
21438 
21439 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":933
21440  * PyArray_SetBaseObject(arr, base)
21441  *
21442  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
21443  * base = PyArray_BASE(arr)
21444  * if base is NULL:
21445  */
21446 
21447 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
21448  PyObject *__pyx_v_base;
21449  PyObject *__pyx_r = NULL;
21450  __Pyx_RefNannyDeclarations
21451  int __pyx_t_1;
21452  __Pyx_RefNannySetupContext("get_array_base", 0);
21453 
21454  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":934
21455  *
21456  * cdef inline object get_array_base(ndarray arr):
21457  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
21458  * if base is NULL:
21459  * return None
21460  */
21461  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
21462 
21463  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":935
21464  * cdef inline object get_array_base(ndarray arr):
21465  * base = PyArray_BASE(arr)
21466  * if base is NULL: # <<<<<<<<<<<<<<
21467  * return None
21468  * return <object>base
21469  */
21470  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
21471  if (__pyx_t_1) {
21472 
21473  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":936
21474  * base = PyArray_BASE(arr)
21475  * if base is NULL:
21476  * return None # <<<<<<<<<<<<<<
21477  * return <object>base
21478  *
21479  */
21480  __Pyx_XDECREF(__pyx_r);
21481  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21482  goto __pyx_L0;
21483 
21484  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":935
21485  * cdef inline object get_array_base(ndarray arr):
21486  * base = PyArray_BASE(arr)
21487  * if base is NULL: # <<<<<<<<<<<<<<
21488  * return None
21489  * return <object>base
21490  */
21491  }
21492 
21493  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":937
21494  * if base is NULL:
21495  * return None
21496  * return <object>base # <<<<<<<<<<<<<<
21497  *
21498  * # Versions of the import_* functions which are more suitable for
21499  */
21500  __Pyx_XDECREF(__pyx_r);
21501  __Pyx_INCREF(((PyObject *)__pyx_v_base));
21502  __pyx_r = ((PyObject *)__pyx_v_base);
21503  goto __pyx_L0;
21504 
21505  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":933
21506  * PyArray_SetBaseObject(arr, base)
21507  *
21508  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
21509  * base = PyArray_BASE(arr)
21510  * if base is NULL:
21511  */
21512 
21513  /* function exit code */
21514  __pyx_L0:;
21515  __Pyx_XGIVEREF(__pyx_r);
21516  __Pyx_RefNannyFinishContext();
21517  return __pyx_r;
21518 }
21519 
21520 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":941
21521  * # Versions of the import_* functions which are more suitable for
21522  * # Cython code.
21523  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
21524  * try:
21525  * __pyx_import_array()
21526  */
21527 
21528 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
21529  int __pyx_r;
21530  __Pyx_RefNannyDeclarations
21531  PyObject *__pyx_t_1 = NULL;
21532  PyObject *__pyx_t_2 = NULL;
21533  PyObject *__pyx_t_3 = NULL;
21534  int __pyx_t_4;
21535  PyObject *__pyx_t_5 = NULL;
21536  PyObject *__pyx_t_6 = NULL;
21537  PyObject *__pyx_t_7 = NULL;
21538  PyObject *__pyx_t_8 = NULL;
21539  int __pyx_lineno = 0;
21540  const char *__pyx_filename = NULL;
21541  int __pyx_clineno = 0;
21542  __Pyx_RefNannySetupContext("import_array", 0);
21543 
21544  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":942
21545  * # Cython code.
21546  * cdef inline int import_array() except -1:
21547  * try: # <<<<<<<<<<<<<<
21548  * __pyx_import_array()
21549  * except Exception:
21550  */
21551  {
21552  __Pyx_PyThreadState_declare
21553  __Pyx_PyThreadState_assign
21554  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
21555  __Pyx_XGOTREF(__pyx_t_1);
21556  __Pyx_XGOTREF(__pyx_t_2);
21557  __Pyx_XGOTREF(__pyx_t_3);
21558  /*try:*/ {
21559 
21560  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":943
21561  * cdef inline int import_array() except -1:
21562  * try:
21563  * __pyx_import_array() # <<<<<<<<<<<<<<
21564  * except Exception:
21565  * raise ImportError("numpy.core.multiarray failed to import")
21566  */
21567  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
21568 
21569  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":942
21570  * # Cython code.
21571  * cdef inline int import_array() except -1:
21572  * try: # <<<<<<<<<<<<<<
21573  * __pyx_import_array()
21574  * except Exception:
21575  */
21576  }
21577  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21578  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21579  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21580  goto __pyx_L8_try_end;
21581  __pyx_L3_error:;
21582 
21583  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":944
21584  * try:
21585  * __pyx_import_array()
21586  * except Exception: # <<<<<<<<<<<<<<
21587  * raise ImportError("numpy.core.multiarray failed to import")
21588  *
21589  */
21590  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
21591  if (__pyx_t_4) {
21592  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
21593  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
21594  __Pyx_GOTREF(__pyx_t_5);
21595  __Pyx_GOTREF(__pyx_t_6);
21596  __Pyx_GOTREF(__pyx_t_7);
21597 
21598  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":945
21599  * __pyx_import_array()
21600  * except Exception:
21601  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
21602  *
21603  * cdef inline int import_umath() except -1:
21604  */
21605  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
21606  __Pyx_GOTREF(__pyx_t_8);
21607  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
21608  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21609  __PYX_ERR(1, 945, __pyx_L5_except_error)
21610  }
21611  goto __pyx_L5_except_error;
21612  __pyx_L5_except_error:;
21613 
21614  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":942
21615  * # Cython code.
21616  * cdef inline int import_array() except -1:
21617  * try: # <<<<<<<<<<<<<<
21618  * __pyx_import_array()
21619  * except Exception:
21620  */
21621  __Pyx_XGIVEREF(__pyx_t_1);
21622  __Pyx_XGIVEREF(__pyx_t_2);
21623  __Pyx_XGIVEREF(__pyx_t_3);
21624  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
21625  goto __pyx_L1_error;
21626  __pyx_L8_try_end:;
21627  }
21628 
21629  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":941
21630  * # Versions of the import_* functions which are more suitable for
21631  * # Cython code.
21632  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
21633  * try:
21634  * __pyx_import_array()
21635  */
21636 
21637  /* function exit code */
21638  __pyx_r = 0;
21639  goto __pyx_L0;
21640  __pyx_L1_error:;
21641  __Pyx_XDECREF(__pyx_t_5);
21642  __Pyx_XDECREF(__pyx_t_6);
21643  __Pyx_XDECREF(__pyx_t_7);
21644  __Pyx_XDECREF(__pyx_t_8);
21645  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
21646  __pyx_r = -1;
21647  __pyx_L0:;
21648  __Pyx_RefNannyFinishContext();
21649  return __pyx_r;
21650 }
21651 
21652 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":947
21653  * raise ImportError("numpy.core.multiarray failed to import")
21654  *
21655  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
21656  * try:
21657  * _import_umath()
21658  */
21659 
21660 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
21661  int __pyx_r;
21662  __Pyx_RefNannyDeclarations
21663  PyObject *__pyx_t_1 = NULL;
21664  PyObject *__pyx_t_2 = NULL;
21665  PyObject *__pyx_t_3 = NULL;
21666  int __pyx_t_4;
21667  PyObject *__pyx_t_5 = NULL;
21668  PyObject *__pyx_t_6 = NULL;
21669  PyObject *__pyx_t_7 = NULL;
21670  PyObject *__pyx_t_8 = NULL;
21671  int __pyx_lineno = 0;
21672  const char *__pyx_filename = NULL;
21673  int __pyx_clineno = 0;
21674  __Pyx_RefNannySetupContext("import_umath", 0);
21675 
21676  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":948
21677  *
21678  * cdef inline int import_umath() except -1:
21679  * try: # <<<<<<<<<<<<<<
21680  * _import_umath()
21681  * except Exception:
21682  */
21683  {
21684  __Pyx_PyThreadState_declare
21685  __Pyx_PyThreadState_assign
21686  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
21687  __Pyx_XGOTREF(__pyx_t_1);
21688  __Pyx_XGOTREF(__pyx_t_2);
21689  __Pyx_XGOTREF(__pyx_t_3);
21690  /*try:*/ {
21691 
21692  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":949
21693  * cdef inline int import_umath() except -1:
21694  * try:
21695  * _import_umath() # <<<<<<<<<<<<<<
21696  * except Exception:
21697  * raise ImportError("numpy.core.umath failed to import")
21698  */
21699  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
21700 
21701  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":948
21702  *
21703  * cdef inline int import_umath() except -1:
21704  * try: # <<<<<<<<<<<<<<
21705  * _import_umath()
21706  * except Exception:
21707  */
21708  }
21709  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21710  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21711  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21712  goto __pyx_L8_try_end;
21713  __pyx_L3_error:;
21714 
21715  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":950
21716  * try:
21717  * _import_umath()
21718  * except Exception: # <<<<<<<<<<<<<<
21719  * raise ImportError("numpy.core.umath failed to import")
21720  *
21721  */
21722  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
21723  if (__pyx_t_4) {
21724  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
21725  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
21726  __Pyx_GOTREF(__pyx_t_5);
21727  __Pyx_GOTREF(__pyx_t_6);
21728  __Pyx_GOTREF(__pyx_t_7);
21729 
21730  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":951
21731  * _import_umath()
21732  * except Exception:
21733  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
21734  *
21735  * cdef inline int import_ufunc() except -1:
21736  */
21737  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
21738  __Pyx_GOTREF(__pyx_t_8);
21739  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
21740  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21741  __PYX_ERR(1, 951, __pyx_L5_except_error)
21742  }
21743  goto __pyx_L5_except_error;
21744  __pyx_L5_except_error:;
21745 
21746  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":948
21747  *
21748  * cdef inline int import_umath() except -1:
21749  * try: # <<<<<<<<<<<<<<
21750  * _import_umath()
21751  * except Exception:
21752  */
21753  __Pyx_XGIVEREF(__pyx_t_1);
21754  __Pyx_XGIVEREF(__pyx_t_2);
21755  __Pyx_XGIVEREF(__pyx_t_3);
21756  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
21757  goto __pyx_L1_error;
21758  __pyx_L8_try_end:;
21759  }
21760 
21761  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":947
21762  * raise ImportError("numpy.core.multiarray failed to import")
21763  *
21764  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
21765  * try:
21766  * _import_umath()
21767  */
21768 
21769  /* function exit code */
21770  __pyx_r = 0;
21771  goto __pyx_L0;
21772  __pyx_L1_error:;
21773  __Pyx_XDECREF(__pyx_t_5);
21774  __Pyx_XDECREF(__pyx_t_6);
21775  __Pyx_XDECREF(__pyx_t_7);
21776  __Pyx_XDECREF(__pyx_t_8);
21777  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
21778  __pyx_r = -1;
21779  __pyx_L0:;
21780  __Pyx_RefNannyFinishContext();
21781  return __pyx_r;
21782 }
21783 
21784 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":953
21785  * raise ImportError("numpy.core.umath failed to import")
21786  *
21787  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
21788  * try:
21789  * _import_umath()
21790  */
21791 
21792 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
21793  int __pyx_r;
21794  __Pyx_RefNannyDeclarations
21795  PyObject *__pyx_t_1 = NULL;
21796  PyObject *__pyx_t_2 = NULL;
21797  PyObject *__pyx_t_3 = NULL;
21798  int __pyx_t_4;
21799  PyObject *__pyx_t_5 = NULL;
21800  PyObject *__pyx_t_6 = NULL;
21801  PyObject *__pyx_t_7 = NULL;
21802  PyObject *__pyx_t_8 = NULL;
21803  int __pyx_lineno = 0;
21804  const char *__pyx_filename = NULL;
21805  int __pyx_clineno = 0;
21806  __Pyx_RefNannySetupContext("import_ufunc", 0);
21807 
21808  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":954
21809  *
21810  * cdef inline int import_ufunc() except -1:
21811  * try: # <<<<<<<<<<<<<<
21812  * _import_umath()
21813  * except Exception:
21814  */
21815  {
21816  __Pyx_PyThreadState_declare
21817  __Pyx_PyThreadState_assign
21818  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
21819  __Pyx_XGOTREF(__pyx_t_1);
21820  __Pyx_XGOTREF(__pyx_t_2);
21821  __Pyx_XGOTREF(__pyx_t_3);
21822  /*try:*/ {
21823 
21824  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":955
21825  * cdef inline int import_ufunc() except -1:
21826  * try:
21827  * _import_umath() # <<<<<<<<<<<<<<
21828  * except Exception:
21829  * raise ImportError("numpy.core.umath failed to import")
21830  */
21831  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
21832 
21833  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":954
21834  *
21835  * cdef inline int import_ufunc() except -1:
21836  * try: # <<<<<<<<<<<<<<
21837  * _import_umath()
21838  * except Exception:
21839  */
21840  }
21841  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21842  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21843  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21844  goto __pyx_L8_try_end;
21845  __pyx_L3_error:;
21846 
21847  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":956
21848  * try:
21849  * _import_umath()
21850  * except Exception: # <<<<<<<<<<<<<<
21851  * raise ImportError("numpy.core.umath failed to import")
21852  *
21853  */
21854  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
21855  if (__pyx_t_4) {
21856  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
21857  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
21858  __Pyx_GOTREF(__pyx_t_5);
21859  __Pyx_GOTREF(__pyx_t_6);
21860  __Pyx_GOTREF(__pyx_t_7);
21861 
21862  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":957
21863  * _import_umath()
21864  * except Exception:
21865  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
21866  *
21867  * cdef extern from *:
21868  */
21869  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
21870  __Pyx_GOTREF(__pyx_t_8);
21871  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
21872  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21873  __PYX_ERR(1, 957, __pyx_L5_except_error)
21874  }
21875  goto __pyx_L5_except_error;
21876  __pyx_L5_except_error:;
21877 
21878  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":954
21879  *
21880  * cdef inline int import_ufunc() except -1:
21881  * try: # <<<<<<<<<<<<<<
21882  * _import_umath()
21883  * except Exception:
21884  */
21885  __Pyx_XGIVEREF(__pyx_t_1);
21886  __Pyx_XGIVEREF(__pyx_t_2);
21887  __Pyx_XGIVEREF(__pyx_t_3);
21888  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
21889  goto __pyx_L1_error;
21890  __pyx_L8_try_end:;
21891  }
21892 
21893  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":953
21894  * raise ImportError("numpy.core.umath failed to import")
21895  *
21896  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
21897  * try:
21898  * _import_umath()
21899  */
21900 
21901  /* function exit code */
21902  __pyx_r = 0;
21903  goto __pyx_L0;
21904  __pyx_L1_error:;
21905  __Pyx_XDECREF(__pyx_t_5);
21906  __Pyx_XDECREF(__pyx_t_6);
21907  __Pyx_XDECREF(__pyx_t_7);
21908  __Pyx_XDECREF(__pyx_t_8);
21909  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
21910  __pyx_r = -1;
21911  __pyx_L0:;
21912  __Pyx_RefNannyFinishContext();
21913  return __pyx_r;
21914 }
21915 
21916 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":967
21917  *
21918  *
21919  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
21920  * """
21921  * Cython equivalent of `isinstance(obj, np.timedelta64)`
21922  */
21923 
21924 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
21925  int __pyx_r;
21926  __Pyx_RefNannyDeclarations
21927  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
21928 
21929  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":979
21930  * bool
21931  * """
21932  * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
21933  *
21934  *
21935  */
21936  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
21937  goto __pyx_L0;
21938 
21939  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":967
21940  *
21941  *
21942  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
21943  * """
21944  * Cython equivalent of `isinstance(obj, np.timedelta64)`
21945  */
21946 
21947  /* function exit code */
21948  __pyx_L0:;
21949  __Pyx_RefNannyFinishContext();
21950  return __pyx_r;
21951 }
21952 
21953 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":982
21954  *
21955  *
21956  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
21957  * """
21958  * Cython equivalent of `isinstance(obj, np.datetime64)`
21959  */
21960 
21961 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
21962  int __pyx_r;
21963  __Pyx_RefNannyDeclarations
21964  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
21965 
21966  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":994
21967  * bool
21968  * """
21969  * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
21970  *
21971  *
21972  */
21973  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
21974  goto __pyx_L0;
21975 
21976  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":982
21977  *
21978  *
21979  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
21980  * """
21981  * Cython equivalent of `isinstance(obj, np.datetime64)`
21982  */
21983 
21984  /* function exit code */
21985  __pyx_L0:;
21986  __Pyx_RefNannyFinishContext();
21987  return __pyx_r;
21988 }
21989 
21990 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":997
21991  *
21992  *
21993  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
21994  * """
21995  * returns the int64 value underlying scalar numpy datetime64 object
21996  */
21997 
21998 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
21999  npy_datetime __pyx_r;
22000 
22001  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1004
22002  * also needed. That can be found using `get_datetime64_unit`.
22003  * """
22004  * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
22005  *
22006  *
22007  */
22008  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
22009  goto __pyx_L0;
22010 
22011  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":997
22012  *
22013  *
22014  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
22015  * """
22016  * returns the int64 value underlying scalar numpy datetime64 object
22017  */
22018 
22019  /* function exit code */
22020  __pyx_L0:;
22021  return __pyx_r;
22022 }
22023 
22024 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1007
22025  *
22026  *
22027  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
22028  * """
22029  * returns the int64 value underlying scalar numpy timedelta64 object
22030  */
22031 
22032 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
22033  npy_timedelta __pyx_r;
22034 
22035  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1011
22036  * returns the int64 value underlying scalar numpy timedelta64 object
22037  * """
22038  * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
22039  *
22040  *
22041  */
22042  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
22043  goto __pyx_L0;
22044 
22045  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1007
22046  *
22047  *
22048  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
22049  * """
22050  * returns the int64 value underlying scalar numpy timedelta64 object
22051  */
22052 
22053  /* function exit code */
22054  __pyx_L0:;
22055  return __pyx_r;
22056 }
22057 
22058 /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1014
22059  *
22060  *
22061  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
22062  * """
22063  * returns the unit part of the dtype for a numpy datetime64 object.
22064  */
22065 
22066 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
22067  NPY_DATETIMEUNIT __pyx_r;
22068 
22069  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1018
22070  * returns the unit part of the dtype for a numpy datetime64 object.
22071  * """
22072  * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
22073  */
22074  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
22075  goto __pyx_L0;
22076 
22077  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1014
22078  *
22079  *
22080  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
22081  * """
22082  * returns the unit part of the dtype for a numpy datetime64 object.
22083  */
22084 
22085  /* function exit code */
22086  __pyx_L0:;
22087  return __pyx_r;
22088 }
22089 
22090 static PyMethodDef __pyx_methods[] = {
22091  {0, 0, 0, 0}
22092 };
22093 
22094 #if PY_MAJOR_VERSION >= 3
22095 #if CYTHON_PEP489_MULTI_PHASE_INIT
22096 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
22097 static int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject* module); /*proto*/
22098 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
22099  {Py_mod_create, (void*)__pyx_pymod_create},
22100  {Py_mod_exec, (void*)__pyx_pymod_exec_subsurfaceTransportFunctions},
22101  {0, NULL}
22102 };
22103 #endif
22104 
22105 static struct PyModuleDef __pyx_moduledef = {
22106  PyModuleDef_HEAD_INIT,
22107  "subsurfaceTransportFunctions",
22108  0, /* m_doc */
22109  #if CYTHON_PEP489_MULTI_PHASE_INIT
22110  0, /* m_size */
22111  #else
22112  -1, /* m_size */
22113  #endif
22114  __pyx_methods /* m_methods */,
22115  #if CYTHON_PEP489_MULTI_PHASE_INIT
22116  __pyx_moduledef_slots, /* m_slots */
22117  #else
22118  NULL, /* m_reload */
22119  #endif
22120  NULL, /* m_traverse */
22121  NULL, /* m_clear */
22122  NULL /* m_free */
22123 };
22124 #endif
22125 #ifndef CYTHON_SMALL_CODE
22126 #if defined(__clang__)
22127  #define CYTHON_SMALL_CODE
22128 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
22129  #define CYTHON_SMALL_CODE __attribute__((cold))
22130 #else
22131  #define CYTHON_SMALL_CODE
22132 #endif
22133 #endif
22134 
22135 static __Pyx_StringTabEntry __pyx_string_tab[] = {
22136  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
22137  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
22138  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
22139  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
22140  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
22141  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22142  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
22143  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
22144  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
22145  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
22146  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
22147  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
22148  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
22149  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
22150  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
22151  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
22152  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
22153  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
22154  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
22155  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
22156  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
22157  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
22158  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22159  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
22160  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
22161  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
22162  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
22163  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
22164  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
22165  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
22166  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
22167  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
22168  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
22169  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
22170  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
22171  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
22172  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
22173  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
22174  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
22175  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
22176  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
22177  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
22178  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
22179  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
22180  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
22181  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
22182  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
22183  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
22184  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
22185  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
22186  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
22187  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
22188  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
22189  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
22190  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
22191  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
22192  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
22193  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
22194  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
22195  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
22196  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
22197  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
22198  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
22199  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
22200  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
22201  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
22202  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
22203  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
22204  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
22205  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
22206  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
22207  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
22208  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
22209  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
22210  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
22211  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
22212  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
22213  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
22214  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
22215  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
22216  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
22217  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
22218  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
22219  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
22220  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
22221  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
22222  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
22223  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
22224  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
22225  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
22226  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
22227  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
22228  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
22229  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
22230  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
22231  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
22232  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
22233  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
22234  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
22235  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
22236  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
22237  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
22238  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
22239  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
22240  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
22241  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
22242  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22243  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
22244  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
22245  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
22246  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
22247  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
22248  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
22249  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
22250  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
22251  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
22252  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
22253  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
22254  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
22255  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
22256  {&__pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_k_proteus_subsurfaceTransportFunct, sizeof(__pyx_k_proteus_subsurfaceTransportFunct), 0, 0, 1, 0},
22257  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
22258  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
22259  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
22260  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
22261  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
22262  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
22263  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
22264  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
22265  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
22266  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
22267  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
22268  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
22269  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
22270  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
22271  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
22272  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
22273  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
22274  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
22275  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
22276  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
22277  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
22278  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
22279  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
22280  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
22281  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
22282  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
22283  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
22284  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
22285  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
22286  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
22287  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
22288  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
22289  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
22290  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
22291  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
22292  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
22293  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
22294  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
22295  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
22296  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
22297  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
22298  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
22299  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
22300  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
22301  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
22302  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
22303  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
22304  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
22305  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
22306  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
22307  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
22308  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
22309  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
22310  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
22311  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
22312  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
22313  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
22314  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
22315  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
22316  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
22317  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
22318  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
22319  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
22320  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
22321  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
22322  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
22323  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
22324  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
22325  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
22326  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
22327  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
22328  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
22329  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
22330  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
22331  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
22332  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
22333  {0, 0, 0, 0, 0, 0, 0}
22334 };
22335 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
22336  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 24, __pyx_L1_error)
22337  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
22338  return 0;
22339  __pyx_L1_error:;
22340  return -1;
22341 }
22342 
22343 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
22344  __Pyx_RefNannyDeclarations
22345  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
22346 
22347  /* "subsurfaceTransportFunctions.pyx":66
22348  * material = elementMaterialTypes[eN]
22349  * for k in range(q_vals.shape[1]):
22350  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
22351  *
22352  *
22353  */
22354  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 66, __pyx_L1_error)
22355  __Pyx_GOTREF(__pyx_slice_);
22356  __Pyx_GIVEREF(__pyx_slice_);
22357 
22358  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":945
22359  * __pyx_import_array()
22360  * except Exception:
22361  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
22362  *
22363  * cdef inline int import_umath() except -1:
22364  */
22365  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 945, __pyx_L1_error)
22366  __Pyx_GOTREF(__pyx_tuple__2);
22367  __Pyx_GIVEREF(__pyx_tuple__2);
22368 
22369  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":951
22370  * _import_umath()
22371  * except Exception:
22372  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22373  *
22374  * cdef inline int import_ufunc() except -1:
22375  */
22376  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 951, __pyx_L1_error)
22377  __Pyx_GOTREF(__pyx_tuple__3);
22378  __Pyx_GIVEREF(__pyx_tuple__3);
22379 
22380  /* "subsurfaceTransportFunctions.pyx":18
22381  * ctypedef int ITYPE_t
22382  *
22383  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
22384  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
22385  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22386  */
22387  __pyx_tuple__4 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 18, __pyx_L1_error)
22388  __Pyx_GOTREF(__pyx_tuple__4);
22389  __Pyx_GIVEREF(__pyx_tuple__4);
22390  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 18, __pyx_L1_error)
22391 
22392  /* "subsurfaceTransportFunctions.pyx":29
22393  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
22394  *
22395  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
22396  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22397  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22398  */
22399  __pyx_tuple__6 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 29, __pyx_L1_error)
22400  __Pyx_GOTREF(__pyx_tuple__6);
22401  __Pyx_GIVEREF(__pyx_tuple__6);
22402  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 29, __pyx_L1_error)
22403 
22404  /* "subsurfaceTransportFunctions.pyx":43
22405  *
22406  * ###
22407  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22408  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
22409  * dict material_functions):
22410  */
22411  __pyx_tuple__8 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 43, __pyx_L1_error)
22412  __Pyx_GOTREF(__pyx_tuple__8);
22413  __Pyx_GIVEREF(__pyx_tuple__8);
22414  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 43, __pyx_L1_error)
22415 
22416  /* "subsurfaceTransportFunctions.pyx":56
22417  * q_vals[eN,k] = material_functions[material]
22418  *
22419  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22420  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
22421  * dict material_functions):
22422  */
22423  __pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 56, __pyx_L1_error)
22424  __Pyx_GOTREF(__pyx_tuple__10);
22425  __Pyx_GIVEREF(__pyx_tuple__10);
22426  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 56, __pyx_L1_error)
22427 
22428  /* "subsurfaceTransportFunctions.pyx":69
22429  *
22430  *
22431  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22432  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22433  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
22434  */
22435  __pyx_tuple__12 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 69, __pyx_L1_error)
22436  __Pyx_GOTREF(__pyx_tuple__12);
22437  __Pyx_GIVEREF(__pyx_tuple__12);
22438  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 69, __pyx_L1_error)
22439 
22440  /* "subsurfaceTransportFunctions.pyx":91
22441  * material_functions[material_right])
22442  *
22443  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22444  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22445  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22446  */
22447  __pyx_tuple__14 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 91, __pyx_L1_error)
22448  __Pyx_GOTREF(__pyx_tuple__14);
22449  __Pyx_GIVEREF(__pyx_tuple__14);
22450  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 91, __pyx_L1_error)
22451 
22452  /* "subsurfaceTransportFunctions.pyx":118
22453  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22454  *
22455  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22456  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22457  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
22458  */
22459  __pyx_tuple__16 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 118, __pyx_L1_error)
22460  __Pyx_GOTREF(__pyx_tuple__16);
22461  __Pyx_GIVEREF(__pyx_tuple__16);
22462  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 118, __pyx_L1_error)
22463 
22464  /* "subsurfaceTransportFunctions.pyx":139
22465  *
22466  *
22467  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22468  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22469  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22470  */
22471  __pyx_tuple__18 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 139, __pyx_L1_error)
22472  __Pyx_GOTREF(__pyx_tuple__18);
22473  __Pyx_GIVEREF(__pyx_tuple__18);
22474  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 139, __pyx_L1_error)
22475 
22476  /* "subsurfaceTransportFunctions.pyx":165
22477  *
22478  * ###
22479  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22480  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22481  * numpy.ndarray[DTYPE_t,ndim=3] x,
22482  */
22483  __pyx_tuple__20 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 165, __pyx_L1_error)
22484  __Pyx_GOTREF(__pyx_tuple__20);
22485  __Pyx_GIVEREF(__pyx_tuple__20);
22486  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 165, __pyx_L1_error)
22487 
22488  /* "subsurfaceTransportFunctions.pyx":180
22489  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
22490  *
22491  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22492  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22493  * numpy.ndarray[DTYPE_t,ndim=3] x,
22494  */
22495  __pyx_tuple__22 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 180, __pyx_L1_error)
22496  __Pyx_GOTREF(__pyx_tuple__22);
22497  __Pyx_GIVEREF(__pyx_tuple__22);
22498  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 180, __pyx_L1_error)
22499 
22500  /* "subsurfaceTransportFunctions.pyx":195
22501  *
22502  *
22503  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22504  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22505  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22506  */
22507  __pyx_tuple__24 = PyTuple_Pack(12, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 195, __pyx_L1_error)
22508  __Pyx_GOTREF(__pyx_tuple__24);
22509  __Pyx_GIVEREF(__pyx_tuple__24);
22510  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 195, __pyx_L1_error)
22511 
22512  /* "subsurfaceTransportFunctions.pyx":219
22513  * material_functions[material_right](x[eN,ebN_local,k],t))
22514  *
22515  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22516  * double t,
22517  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22518  */
22519  __pyx_tuple__26 = PyTuple_Pack(17, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 219, __pyx_L1_error)
22520  __Pyx_GOTREF(__pyx_tuple__26);
22521  __Pyx_GIVEREF(__pyx_tuple__26);
22522  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 219, __pyx_L1_error)
22523 
22524  /* "subsurfaceTransportFunctions.pyx":248
22525  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22526  *
22527  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22528  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22529  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22530  */
22531  __pyx_tuple__28 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 248, __pyx_L1_error)
22532  __Pyx_GOTREF(__pyx_tuple__28);
22533  __Pyx_GIVEREF(__pyx_tuple__28);
22534  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 248, __pyx_L1_error)
22535 
22536  /* "subsurfaceTransportFunctions.pyx":271
22537  *
22538  *
22539  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22540  * double t,
22541  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22542  */
22543  __pyx_tuple__30 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 271, __pyx_L1_error)
22544  __Pyx_GOTREF(__pyx_tuple__30);
22545  __Pyx_GIVEREF(__pyx_tuple__30);
22546  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 271, __pyx_L1_error)
22547 
22548  /* "subsurfaceTransportFunctions.pyx":301
22549  *
22550  * ##################################################
22551  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
22552  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22553  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22554  */
22555  __pyx_tuple__32 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 301, __pyx_L1_error)
22556  __Pyx_GOTREF(__pyx_tuple__32);
22557  __Pyx_GIVEREF(__pyx_tuple__32);
22558  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 301, __pyx_L1_error)
22559 
22560  /* "subsurfaceTransportFunctions.pyx":359
22561  *
22562  *
22563  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
22564  * double beta,
22565  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22566  */
22567  __pyx_tuple__34 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 359, __pyx_L1_error)
22568  __Pyx_GOTREF(__pyx_tuple__34);
22569  __Pyx_GIVEREF(__pyx_tuple__34);
22570  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 359, __pyx_L1_error)
22571 
22572  /* "subsurfaceTransportFunctions.pyx":486
22573  * #eN for upwind
22574  *
22575  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
22576  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22577  * numpy.ndarray[ITYPE_t,ndim=1] colind,
22578  */
22579  __pyx_tuple__36 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 486, __pyx_L1_error)
22580  __Pyx_GOTREF(__pyx_tuple__36);
22581  __Pyx_GIVEREF(__pyx_tuple__36);
22582  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 486, __pyx_L1_error)
22583 
22584  /* "subsurfaceTransportFunctions.pyx":574
22585  * #i
22586  * #eN
22587  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
22588  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22589  * numpy.ndarray[ITYPE_t,ndim=1] colind,
22590  */
22591  __pyx_tuple__38 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 574, __pyx_L1_error)
22592  __Pyx_GOTREF(__pyx_tuple__38);
22593  __Pyx_GIVEREF(__pyx_tuple__38);
22594  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 574, __pyx_L1_error)
22595 
22596  /* "subsurfaceTransportFunctions.pyx":673
22597  * ##################################################
22598  *
22599  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
22600  * numpy.ndarray[DTYPE_t,ndim=3] w,
22601  * numpy.ndarray[DTYPE_t,ndim=2] dV,
22602  */
22603  __pyx_tuple__40 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 673, __pyx_L1_error)
22604  __Pyx_GOTREF(__pyx_tuple__40);
22605  __Pyx_GIVEREF(__pyx_tuple__40);
22606  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 673, __pyx_L1_error)
22607 
22608  /* "subsurfaceTransportFunctions.pyx":692
22609  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
22610  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
22611  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
22612  * numpy.ndarray[DTYPE_t,ndim=3] w,
22613  * numpy.ndarray[DTYPE_t,ndim=3] v,
22614  */
22615  __pyx_tuple__42 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 692, __pyx_L1_error)
22616  __Pyx_GOTREF(__pyx_tuple__42);
22617  __Pyx_GIVEREF(__pyx_tuple__42);
22618  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 692, __pyx_L1_error)
22619 
22620  /* "subsurfaceTransportFunctions.pyx":717
22621  * #ELLAM
22622  * ########################################################################
22623  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
22624  * numpy.ndarray[DTYPE_t,ndim=4] n,
22625  * numpy.ndarray[DTYPE_t,ndim=3] dS,
22626  */
22627  __pyx_tuple__44 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 717, __pyx_L1_error)
22628  __Pyx_GOTREF(__pyx_tuple__44);
22629  __Pyx_GIVEREF(__pyx_tuple__44);
22630  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 717, __pyx_L1_error)
22631 
22632  /* "subsurfaceTransportFunctions.pyx":732
22633  * flux[eN,ebN] = integral
22634  *
22635  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
22636  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
22637  * numpy.ndarray[DTYPE_t,ndim=2] dm,
22638  */
22639  __pyx_tuple__46 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 732, __pyx_L1_error)
22640  __Pyx_GOTREF(__pyx_tuple__46);
22641  __Pyx_GIVEREF(__pyx_tuple__46);
22642  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 732, __pyx_L1_error)
22643 
22644  /* "subsurfaceTransportFunctions.pyx":753
22645  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
22646  *
22647  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
22648  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
22649  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
22650  */
22651  __pyx_tuple__48 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 753, __pyx_L1_error)
22652  __Pyx_GOTREF(__pyx_tuple__48);
22653  __Pyx_GIVEREF(__pyx_tuple__48);
22654  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 753, __pyx_L1_error)
22655 
22656  /* "subsurfaceTransportFunctions.pyx":776
22657  *
22658  * #problem specific velocity evaluation
22659  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
22660  * double t,
22661  * double tForReversal,
22662  */
22663  __pyx_tuple__50 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 776, __pyx_L1_error)
22664  __Pyx_GOTREF(__pyx_tuple__50);
22665  __Pyx_GIVEREF(__pyx_tuple__50);
22666  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 776, __pyx_L1_error)
22667 
22668  /* "subsurfaceTransportFunctions.pyx":816
22669  *
22670  *
22671  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
22672  * double t,
22673  * double tForReversal,
22674  */
22675  __pyx_tuple__52 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 816, __pyx_L1_error)
22676  __Pyx_GOTREF(__pyx_tuple__52);
22677  __Pyx_GIVEREF(__pyx_tuple__52);
22678  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 816, __pyx_L1_error)
22679 
22680  /* "subsurfaceTransportFunctions.pyx":859
22681  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
22682  *
22683  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
22684  * double t,
22685  * double tForReversal,
22686  */
22687  __pyx_tuple__54 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 859, __pyx_L1_error)
22688  __Pyx_GOTREF(__pyx_tuple__54);
22689  __Pyx_GIVEREF(__pyx_tuple__54);
22690  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 859, __pyx_L1_error)
22691 
22692  /* "subsurfaceTransportFunctions.pyx":884
22693  * v[eN,k,2]=zVelocity
22694  *
22695  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
22696  * double t,
22697  * double tForReversal,
22698  */
22699  __pyx_tuple__56 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 884, __pyx_L1_error)
22700  __Pyx_GOTREF(__pyx_tuple__56);
22701  __Pyx_GIVEREF(__pyx_tuple__56);
22702  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 884, __pyx_L1_error)
22703 
22704  /* "subsurfaceTransportFunctions.pyx":911
22705  * v[eN,ebN,k,2]=zVelocity
22706  *
22707  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
22708  * numpy.ndarray[DTYPE_t,ndim=3] x,
22709  * numpy.ndarray[DTYPE_t,ndim=3] v):
22710  */
22711  __pyx_tuple__58 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 911, __pyx_L1_error)
22712  __Pyx_GOTREF(__pyx_tuple__58);
22713  __Pyx_GIVEREF(__pyx_tuple__58);
22714  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 911, __pyx_L1_error)
22715 
22716  /* "subsurfaceTransportFunctions.pyx":924
22717  *
22718  *
22719  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
22720  * numpy.ndarray[DTYPE_t,ndim=4] x,
22721  * numpy.ndarray[DTYPE_t,ndim=4] v):
22722  */
22723  __pyx_tuple__60 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 924, __pyx_L1_error)
22724  __Pyx_GOTREF(__pyx_tuple__60);
22725  __Pyx_GIVEREF(__pyx_tuple__60);
22726  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 924, __pyx_L1_error)
22727  __Pyx_RefNannyFinishContext();
22728  return 0;
22729  __pyx_L1_error:;
22730  __Pyx_RefNannyFinishContext();
22731  return -1;
22732 }
22733 
22734 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
22735  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22736  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22737  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
22738  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22739  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) __PYX_ERR(0, 1, __pyx_L1_error)
22740  return 0;
22741  __pyx_L1_error:;
22742  return -1;
22743 }
22744 
22745 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
22746 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
22747 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
22748 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
22749 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
22750 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
22751 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
22752 
22753 static int __Pyx_modinit_global_init_code(void) {
22754  __Pyx_RefNannyDeclarations
22755  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
22756  /*--- Global init code ---*/
22757  __Pyx_RefNannyFinishContext();
22758  return 0;
22759 }
22760 
22761 static int __Pyx_modinit_variable_export_code(void) {
22762  __Pyx_RefNannyDeclarations
22763  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
22764  /*--- Variable export code ---*/
22765  __Pyx_RefNannyFinishContext();
22766  return 0;
22767 }
22768 
22769 static int __Pyx_modinit_function_export_code(void) {
22770  __Pyx_RefNannyDeclarations
22771  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
22772  /*--- Function export code ---*/
22773  __Pyx_RefNannyFinishContext();
22774  return 0;
22775 }
22776 
22777 static int __Pyx_modinit_type_init_code(void) {
22778  __Pyx_RefNannyDeclarations
22779  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
22780  /*--- Type init code ---*/
22781  __Pyx_RefNannyFinishContext();
22782  return 0;
22783 }
22784 
22785 static int __Pyx_modinit_type_import_code(void) {
22786  __Pyx_RefNannyDeclarations
22787  PyObject *__pyx_t_1 = NULL;
22788  int __pyx_lineno = 0;
22789  const char *__pyx_filename = NULL;
22790  int __pyx_clineno = 0;
22791  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
22792  /*--- Type import code ---*/
22793  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
22794  __Pyx_GOTREF(__pyx_t_1);
22795  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
22796  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
22797  sizeof(PyTypeObject),
22798  #else
22799  sizeof(PyHeapTypeObject),
22800  #endif
22801  __Pyx_ImportType_CheckSize_Warn);
22802  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
22803  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22804  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
22805  __Pyx_GOTREF(__pyx_t_1);
22806  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
22807  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
22808  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
22809  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
22810  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
22811  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
22812  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
22813  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
22814  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22815  if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
22816  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22817  if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
22818  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22819  if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
22820  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22821  if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
22822  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22823  if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
22824  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22825  if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
22826  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22827  if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
22828  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22829  if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
22830  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22831  if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
22832  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22833  if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
22834  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
22835  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
22836  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22837  __Pyx_RefNannyFinishContext();
22838  return 0;
22839  __pyx_L1_error:;
22840  __Pyx_XDECREF(__pyx_t_1);
22841  __Pyx_RefNannyFinishContext();
22842  return -1;
22843 }
22844 
22845 static int __Pyx_modinit_variable_import_code(void) {
22846  __Pyx_RefNannyDeclarations
22847  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
22848  /*--- Variable import code ---*/
22849  __Pyx_RefNannyFinishContext();
22850  return 0;
22851 }
22852 
22853 static int __Pyx_modinit_function_import_code(void) {
22854  __Pyx_RefNannyDeclarations
22855  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
22856  /*--- Function import code ---*/
22857  __Pyx_RefNannyFinishContext();
22858  return 0;
22859 }
22860 
22861 
22862 #ifndef CYTHON_NO_PYINIT_EXPORT
22863 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
22864 #elif PY_MAJOR_VERSION < 3
22865 #ifdef __cplusplus
22866 #define __Pyx_PyMODINIT_FUNC extern "C" void
22867 #else
22868 #define __Pyx_PyMODINIT_FUNC void
22869 #endif
22870 #else
22871 #ifdef __cplusplus
22872 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
22873 #else
22874 #define __Pyx_PyMODINIT_FUNC PyObject *
22875 #endif
22876 #endif
22877 
22878 
22879 #if PY_MAJOR_VERSION < 3
22880 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
22881 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
22882 #else
22883 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
22884 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
22885 #if CYTHON_PEP489_MULTI_PHASE_INIT
22886 {
22887  return PyModuleDef_Init(&__pyx_moduledef);
22888 }
22889 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
22890  #if PY_VERSION_HEX >= 0x030700A1
22891  static PY_INT64_T main_interpreter_id = -1;
22892  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
22893  if (main_interpreter_id == -1) {
22894  main_interpreter_id = current_id;
22895  return (unlikely(current_id == -1)) ? -1 : 0;
22896  } else if (unlikely(main_interpreter_id != current_id))
22897  #else
22898  static PyInterpreterState *main_interpreter = NULL;
22899  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
22900  if (!main_interpreter) {
22901  main_interpreter = current_interpreter;
22902  } else if (unlikely(main_interpreter != current_interpreter))
22903  #endif
22904  {
22905  PyErr_SetString(
22906  PyExc_ImportError,
22907  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
22908  return -1;
22909  }
22910  return 0;
22911 }
22912 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
22913  PyObject *value = PyObject_GetAttrString(spec, from_name);
22914  int result = 0;
22915  if (likely(value)) {
22916  if (allow_none || value != Py_None) {
22917  result = PyDict_SetItemString(moddict, to_name, value);
22918  }
22919  Py_DECREF(value);
22920  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
22921  PyErr_Clear();
22922  } else {
22923  result = -1;
22924  }
22925  return result;
22926 }
22927 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
22928  PyObject *module = NULL, *moddict, *modname;
22929  if (__Pyx_check_single_interpreter())
22930  return NULL;
22931  if (__pyx_m)
22932  return __Pyx_NewRef(__pyx_m);
22933  modname = PyObject_GetAttrString(spec, "name");
22934  if (unlikely(!modname)) goto bad;
22935  module = PyModule_NewObject(modname);
22936  Py_DECREF(modname);
22937  if (unlikely(!module)) goto bad;
22938  moddict = PyModule_GetDict(module);
22939  if (unlikely(!moddict)) goto bad;
22940  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
22941  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
22942  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
22943  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
22944  return module;
22945 bad:
22946  Py_XDECREF(module);
22947  return NULL;
22948 }
22949 
22950 
22951 static CYTHON_SMALL_CODE int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject *__pyx_pyinit_module)
22952 #endif
22953 #endif
22954 {
22955  PyObject *__pyx_t_1 = NULL;
22956  int __pyx_lineno = 0;
22957  const char *__pyx_filename = NULL;
22958  int __pyx_clineno = 0;
22959  __Pyx_RefNannyDeclarations
22960  #if CYTHON_PEP489_MULTI_PHASE_INIT
22961  if (__pyx_m) {
22962  if (__pyx_m == __pyx_pyinit_module) return 0;
22963  PyErr_SetString(PyExc_RuntimeError, "Module 'subsurfaceTransportFunctions' has already been imported. Re-initialisation is not supported.");
22964  return -1;
22965  }
22966  #elif PY_MAJOR_VERSION >= 3
22967  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
22968  #endif
22969  #if CYTHON_REFNANNY
22970 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
22971 if (!__Pyx_RefNanny) {
22972  PyErr_Clear();
22973  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
22974  if (!__Pyx_RefNanny)
22975  Py_FatalError("failed to import 'refnanny' module");
22976 }
22977 #endif
22978  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
22979  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22980  #ifdef __Pxy_PyFrame_Initialize_Offsets
22981  __Pxy_PyFrame_Initialize_Offsets();
22982  #endif
22983  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
22984  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
22985  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
22986  #ifdef __Pyx_CyFunction_USED
22987  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22988  #endif
22989  #ifdef __Pyx_FusedFunction_USED
22990  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22991  #endif
22992  #ifdef __Pyx_Coroutine_USED
22993  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22994  #endif
22995  #ifdef __Pyx_Generator_USED
22996  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22997  #endif
22998  #ifdef __Pyx_AsyncGen_USED
22999  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23000  #endif
23001  #ifdef __Pyx_StopAsyncIteration_USED
23002  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23003  #endif
23004  /*--- Library function declarations ---*/
23005  /*--- Threads initialization code ---*/
23006  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
23007  PyEval_InitThreads();
23008  #endif
23009  /*--- Module creation code ---*/
23010  #if CYTHON_PEP489_MULTI_PHASE_INIT
23011  __pyx_m = __pyx_pyinit_module;
23012  Py_INCREF(__pyx_m);
23013  #else
23014  #if PY_MAJOR_VERSION < 3
23015  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23016  #else
23017  __pyx_m = PyModule_Create(&__pyx_moduledef);
23018  #endif
23019  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23020  #endif
23021  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23022  Py_INCREF(__pyx_d);
23023  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23024  Py_INCREF(__pyx_b);
23025  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
23026  Py_INCREF(__pyx_cython_runtime);
23027  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23028  /*--- Initialize various global constants etc. ---*/
23029  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23030  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
23031  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23032  #endif
23033  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
23034  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23035  }
23036  #if PY_MAJOR_VERSION >= 3
23037  {
23038  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23039  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
23040  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23041  }
23042  }
23043  #endif
23044  /*--- Builtin init code ---*/
23045  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23046  /*--- Constants init code ---*/
23047  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23048  /*--- Global type/function init code ---*/
23049  (void)__Pyx_modinit_global_init_code();
23050  (void)__Pyx_modinit_variable_export_code();
23051  (void)__Pyx_modinit_function_export_code();
23052  (void)__Pyx_modinit_type_init_code();
23053  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23054  (void)__Pyx_modinit_variable_import_code();
23055  (void)__Pyx_modinit_function_import_code();
23056  /*--- Execution code ---*/
23057  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23058  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23059  #endif
23060 
23061  /* "subsurfaceTransportFunctions.pyx":1
23062  * import numpy # <<<<<<<<<<<<<<
23063  * cimport numpy
23064  * cdef extern from "math.h":
23065  */
23066  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23067  __Pyx_GOTREF(__pyx_t_1);
23068  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23069  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23070 
23071  /* "subsurfaceTransportFunctions.pyx":18
23072  * ctypedef int ITYPE_t
23073  *
23074  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
23075  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
23076  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23077  */
23078  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
23079  __Pyx_GOTREF(__pyx_t_1);
23080  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
23081  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23082 
23083  /* "subsurfaceTransportFunctions.pyx":29
23084  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
23085  *
23086  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
23087  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23088  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23089  */
23090  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
23091  __Pyx_GOTREF(__pyx_t_1);
23092  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
23093  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23094 
23095  /* "subsurfaceTransportFunctions.pyx":43
23096  *
23097  * ###
23098  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23099  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
23100  * dict material_functions):
23101  */
23102  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
23103  __Pyx_GOTREF(__pyx_t_1);
23104  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
23105  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23106 
23107  /* "subsurfaceTransportFunctions.pyx":56
23108  * q_vals[eN,k] = material_functions[material]
23109  *
23110  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23111  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
23112  * dict material_functions):
23113  */
23114  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
23115  __Pyx_GOTREF(__pyx_t_1);
23116  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
23117  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23118 
23119  /* "subsurfaceTransportFunctions.pyx":69
23120  *
23121  *
23122  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23123  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23124  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
23125  */
23126  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
23127  __Pyx_GOTREF(__pyx_t_1);
23128  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
23129  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23130 
23131  /* "subsurfaceTransportFunctions.pyx":91
23132  * material_functions[material_right])
23133  *
23134  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23135  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23136  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23137  */
23138  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
23139  __Pyx_GOTREF(__pyx_t_1);
23140  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
23141  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23142 
23143  /* "subsurfaceTransportFunctions.pyx":118
23144  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23145  *
23146  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23147  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23148  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
23149  */
23150  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
23151  __Pyx_GOTREF(__pyx_t_1);
23152  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
23153  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23154 
23155  /* "subsurfaceTransportFunctions.pyx":139
23156  *
23157  *
23158  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23159  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23160  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23161  */
23162  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
23163  __Pyx_GOTREF(__pyx_t_1);
23164  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
23165  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23166 
23167  /* "subsurfaceTransportFunctions.pyx":165
23168  *
23169  * ###
23170  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23171  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23172  * numpy.ndarray[DTYPE_t,ndim=3] x,
23173  */
23174  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
23175  __Pyx_GOTREF(__pyx_t_1);
23176  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
23177  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23178 
23179  /* "subsurfaceTransportFunctions.pyx":180
23180  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
23181  *
23182  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23183  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23184  * numpy.ndarray[DTYPE_t,ndim=3] x,
23185  */
23186  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
23187  __Pyx_GOTREF(__pyx_t_1);
23188  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
23189  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23190 
23191  /* "subsurfaceTransportFunctions.pyx":195
23192  *
23193  *
23194  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23195  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23196  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23197  */
23198  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
23199  __Pyx_GOTREF(__pyx_t_1);
23200  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
23201  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23202 
23203  /* "subsurfaceTransportFunctions.pyx":219
23204  * material_functions[material_right](x[eN,ebN_local,k],t))
23205  *
23206  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23207  * double t,
23208  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23209  */
23210  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
23211  __Pyx_GOTREF(__pyx_t_1);
23212  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
23213  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23214 
23215  /* "subsurfaceTransportFunctions.pyx":248
23216  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23217  *
23218  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23219  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23220  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23221  */
23222  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
23223  __Pyx_GOTREF(__pyx_t_1);
23224  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
23225  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23226 
23227  /* "subsurfaceTransportFunctions.pyx":271
23228  *
23229  *
23230  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23231  * double t,
23232  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23233  */
23234  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
23235  __Pyx_GOTREF(__pyx_t_1);
23236  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
23237  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23238 
23239  /* "subsurfaceTransportFunctions.pyx":301
23240  *
23241  * ##################################################
23242  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
23243  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23244  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23245  */
23246  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
23247  __Pyx_GOTREF(__pyx_t_1);
23248  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
23249  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23250 
23251  /* "subsurfaceTransportFunctions.pyx":359
23252  *
23253  *
23254  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
23255  * double beta,
23256  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23257  */
23258  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
23259  __Pyx_GOTREF(__pyx_t_1);
23260  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
23261  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23262 
23263  /* "subsurfaceTransportFunctions.pyx":486
23264  * #eN for upwind
23265  *
23266  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23267  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23268  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23269  */
23270  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
23271  __Pyx_GOTREF(__pyx_t_1);
23272  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
23273  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23274 
23275  /* "subsurfaceTransportFunctions.pyx":574
23276  * #i
23277  * #eN
23278  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23279  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23280  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23281  */
23282  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
23283  __Pyx_GOTREF(__pyx_t_1);
23284  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
23285  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23286 
23287  /* "subsurfaceTransportFunctions.pyx":673
23288  * ##################################################
23289  *
23290  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
23291  * numpy.ndarray[DTYPE_t,ndim=3] w,
23292  * numpy.ndarray[DTYPE_t,ndim=2] dV,
23293  */
23294  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
23295  __Pyx_GOTREF(__pyx_t_1);
23296  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
23297  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23298 
23299  /* "subsurfaceTransportFunctions.pyx":692
23300  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
23301  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
23302  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
23303  * numpy.ndarray[DTYPE_t,ndim=3] w,
23304  * numpy.ndarray[DTYPE_t,ndim=3] v,
23305  */
23306  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
23307  __Pyx_GOTREF(__pyx_t_1);
23308  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
23309  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23310 
23311  /* "subsurfaceTransportFunctions.pyx":717
23312  * #ELLAM
23313  * ########################################################################
23314  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
23315  * numpy.ndarray[DTYPE_t,ndim=4] n,
23316  * numpy.ndarray[DTYPE_t,ndim=3] dS,
23317  */
23318  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
23319  __Pyx_GOTREF(__pyx_t_1);
23320  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
23321  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23322 
23323  /* "subsurfaceTransportFunctions.pyx":732
23324  * flux[eN,ebN] = integral
23325  *
23326  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
23327  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
23328  * numpy.ndarray[DTYPE_t,ndim=2] dm,
23329  */
23330  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
23331  __Pyx_GOTREF(__pyx_t_1);
23332  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
23333  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23334 
23335  /* "subsurfaceTransportFunctions.pyx":753
23336  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
23337  *
23338  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
23339  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
23340  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
23341  */
23342  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
23343  __Pyx_GOTREF(__pyx_t_1);
23344  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
23345  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23346 
23347  /* "subsurfaceTransportFunctions.pyx":776
23348  *
23349  * #problem specific velocity evaluation
23350  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23351  * double t,
23352  * double tForReversal,
23353  */
23354  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
23355  __Pyx_GOTREF(__pyx_t_1);
23356  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
23357  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23358 
23359  /* "subsurfaceTransportFunctions.pyx":816
23360  *
23361  *
23362  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23363  * double t,
23364  * double tForReversal,
23365  */
23366  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
23367  __Pyx_GOTREF(__pyx_t_1);
23368  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
23369  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23370 
23371  /* "subsurfaceTransportFunctions.pyx":859
23372  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23373  *
23374  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23375  * double t,
23376  * double tForReversal,
23377  */
23378  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
23379  __Pyx_GOTREF(__pyx_t_1);
23380  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
23381  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23382 
23383  /* "subsurfaceTransportFunctions.pyx":884
23384  * v[eN,k,2]=zVelocity
23385  *
23386  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23387  * double t,
23388  * double tForReversal,
23389  */
23390  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
23391  __Pyx_GOTREF(__pyx_t_1);
23392  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
23393  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23394 
23395  /* "subsurfaceTransportFunctions.pyx":911
23396  * v[eN,ebN,k,2]=zVelocity
23397  *
23398  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
23399  * numpy.ndarray[DTYPE_t,ndim=3] x,
23400  * numpy.ndarray[DTYPE_t,ndim=3] v):
23401  */
23402  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
23403  __Pyx_GOTREF(__pyx_t_1);
23404  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
23405  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23406 
23407  /* "subsurfaceTransportFunctions.pyx":924
23408  *
23409  *
23410  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
23411  * numpy.ndarray[DTYPE_t,ndim=4] x,
23412  * numpy.ndarray[DTYPE_t,ndim=4] v):
23413  */
23414  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
23415  __Pyx_GOTREF(__pyx_t_1);
23416  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
23417  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23418 
23419  /* "subsurfaceTransportFunctions.pyx":1
23420  * import numpy # <<<<<<<<<<<<<<
23421  * cimport numpy
23422  * cdef extern from "math.h":
23423  */
23424  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23425  __Pyx_GOTREF(__pyx_t_1);
23426  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23427  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23428 
23429  /* "../miniconda3/envs/proteus-dev/lib/python3.9/site-packages/numpy/__init__.pxd":1014
23430  *
23431  *
23432  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
23433  * """
23434  * returns the unit part of the dtype for a numpy datetime64 object.
23435  */
23436 
23437  /*--- Wrapped vars code ---*/
23438 
23439  goto __pyx_L0;
23440  __pyx_L1_error:;
23441  __Pyx_XDECREF(__pyx_t_1);
23442  if (__pyx_m) {
23443  if (__pyx_d) {
23444  __Pyx_AddTraceback("init subsurfaceTransportFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
23445  }
23446  Py_CLEAR(__pyx_m);
23447  } else if (!PyErr_Occurred()) {
23448  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
23449  }
23450  __pyx_L0:;
23451  __Pyx_RefNannyFinishContext();
23452  #if CYTHON_PEP489_MULTI_PHASE_INIT
23453  return (__pyx_m != NULL) ? 0 : -1;
23454  #elif PY_MAJOR_VERSION >= 3
23455  return __pyx_m;
23456  #else
23457  return;
23458  #endif
23459 }
23460 
23461 /* --- Runtime support code --- */
23462 /* Refnanny */
23463 #if CYTHON_REFNANNY
23464 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
23465  PyObject *m = NULL, *p = NULL;
23466  void *r = NULL;
23467  m = PyImport_ImportModule(modname);
23468  if (!m) goto end;
23469  p = PyObject_GetAttrString(m, "RefNannyAPI");
23470  if (!p) goto end;
23471  r = PyLong_AsVoidPtr(p);
23472 end:
23473  Py_XDECREF(p);
23474  Py_XDECREF(m);
23475  return (__Pyx_RefNannyAPIStruct *)r;
23476 }
23477 #endif
23478 
23479 /* PyObjectGetAttrStr */
23480 #if CYTHON_USE_TYPE_SLOTS
23481 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
23482  PyTypeObject* tp = Py_TYPE(obj);
23483  if (likely(tp->tp_getattro))
23484  return tp->tp_getattro(obj, attr_name);
23485 #if PY_MAJOR_VERSION < 3
23486  if (likely(tp->tp_getattr))
23487  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
23488 #endif
23489  return PyObject_GetAttr(obj, attr_name);
23490 }
23491 #endif
23492 
23493 /* GetBuiltinName */
23494 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23495  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23496  if (unlikely(!result)) {
23497  PyErr_Format(PyExc_NameError,
23498 #if PY_MAJOR_VERSION >= 3
23499  "name '%U' is not defined", name);
23500 #else
23501  "name '%.200s' is not defined", PyString_AS_STRING(name));
23502 #endif
23503  }
23504  return result;
23505 }
23506 
23507 /* RaiseArgTupleInvalid */
23508 static void __Pyx_RaiseArgtupleInvalid(
23509  const char* func_name,
23510  int exact,
23511  Py_ssize_t num_min,
23512  Py_ssize_t num_max,
23513  Py_ssize_t num_found)
23514 {
23515  Py_ssize_t num_expected;
23516  const char *more_or_less;
23517  if (num_found < num_min) {
23518  num_expected = num_min;
23519  more_or_less = "at least";
23520  } else {
23521  num_expected = num_max;
23522  more_or_less = "at most";
23523  }
23524  if (exact) {
23525  more_or_less = "exactly";
23526  }
23527  PyErr_Format(PyExc_TypeError,
23528  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
23529  func_name, more_or_less, num_expected,
23530  (num_expected == 1) ? "" : "s", num_found);
23531 }
23532 
23533 /* RaiseDoubleKeywords */
23534 static void __Pyx_RaiseDoubleKeywordsError(
23535  const char* func_name,
23536  PyObject* kw_name)
23537 {
23538  PyErr_Format(PyExc_TypeError,
23539  #if PY_MAJOR_VERSION >= 3
23540  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23541  #else
23542  "%s() got multiple values for keyword argument '%s'", func_name,
23543  PyString_AsString(kw_name));
23544  #endif
23545 }
23546 
23547 /* ParseKeywords */
23548 static int __Pyx_ParseOptionalKeywords(
23549  PyObject *kwds,
23550  PyObject **argnames[],
23551  PyObject *kwds2,
23552  PyObject *values[],
23553  Py_ssize_t num_pos_args,
23554  const char* function_name)
23555 {
23556  PyObject *key = 0, *value = 0;
23557  Py_ssize_t pos = 0;
23558  PyObject*** name;
23559  PyObject*** first_kw_arg = argnames + num_pos_args;
23560  while (PyDict_Next(kwds, &pos, &key, &value)) {
23561  name = first_kw_arg;
23562  while (*name && (**name != key)) name++;
23563  if (*name) {
23564  values[name-argnames] = value;
23565  continue;
23566  }
23567  name = first_kw_arg;
23568  #if PY_MAJOR_VERSION < 3
23569  if (likely(PyString_Check(key))) {
23570  while (*name) {
23571  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23572  && _PyString_Eq(**name, key)) {
23573  values[name-argnames] = value;
23574  break;
23575  }
23576  name++;
23577  }
23578  if (*name) continue;
23579  else {
23580  PyObject*** argname = argnames;
23581  while (argname != first_kw_arg) {
23582  if ((**argname == key) || (
23583  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23584  && _PyString_Eq(**argname, key))) {
23585  goto arg_passed_twice;
23586  }
23587  argname++;
23588  }
23589  }
23590  } else
23591  #endif
23592  if (likely(PyUnicode_Check(key))) {
23593  while (*name) {
23594  int cmp = (**name == key) ? 0 :
23595  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23596  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23597  #endif
23598  PyUnicode_Compare(**name, key);
23599  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23600  if (cmp == 0) {
23601  values[name-argnames] = value;
23602  break;
23603  }
23604  name++;
23605  }
23606  if (*name) continue;
23607  else {
23608  PyObject*** argname = argnames;
23609  while (argname != first_kw_arg) {
23610  int cmp = (**argname == key) ? 0 :
23611  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23612  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23613  #endif
23614  PyUnicode_Compare(**argname, key);
23615  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23616  if (cmp == 0) goto arg_passed_twice;
23617  argname++;
23618  }
23619  }
23620  } else
23621  goto invalid_keyword_type;
23622  if (kwds2) {
23623  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
23624  } else {
23625  goto invalid_keyword;
23626  }
23627  }
23628  return 0;
23629 arg_passed_twice:
23630  __Pyx_RaiseDoubleKeywordsError(function_name, key);
23631  goto bad;
23632 invalid_keyword_type:
23633  PyErr_Format(PyExc_TypeError,
23634  "%.200s() keywords must be strings", function_name);
23635  goto bad;
23636 invalid_keyword:
23637  PyErr_Format(PyExc_TypeError,
23638  #if PY_MAJOR_VERSION < 3
23639  "%.200s() got an unexpected keyword argument '%.200s'",
23640  function_name, PyString_AsString(key));
23641  #else
23642  "%s() got an unexpected keyword argument '%U'",
23643  function_name, key);
23644  #endif
23645 bad:
23646  return -1;
23647 }
23648 
23649 /* ArgTypeTest */
23650 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
23651 {
23652  if (unlikely(!type)) {
23653  PyErr_SetString(PyExc_SystemError, "Missing type object");
23654  return 0;
23655  }
23656  else if (exact) {
23657  #if PY_MAJOR_VERSION == 2
23658  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
23659  #endif
23660  }
23661  else {
23662  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
23663  }
23664  PyErr_Format(PyExc_TypeError,
23665  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23666  name, type->tp_name, Py_TYPE(obj)->tp_name);
23667  return 0;
23668 }
23669 
23670 /* IsLittleEndian */
23671 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
23672 {
23673  union {
23674  uint32_t u32;
23675  uint8_t u8[4];
23676  } S;
23677  S.u32 = 0x01020304;
23678  return S.u8[0] == 4;
23679 }
23680 
23681 /* BufferFormatCheck */
23682 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
23683  __Pyx_BufFmt_StackElem* stack,
23684  __Pyx_TypeInfo* type) {
23685  stack[0].field = &ctx->root;
23686  stack[0].parent_offset = 0;
23687  ctx->root.type = type;
23688  ctx->root.name = "buffer dtype";
23689  ctx->root.offset = 0;
23690  ctx->head = stack;
23691  ctx->head->field = &ctx->root;
23692  ctx->fmt_offset = 0;
23693  ctx->head->parent_offset = 0;
23694  ctx->new_packmode = '@';
23695  ctx->enc_packmode = '@';
23696  ctx->new_count = 1;
23697  ctx->enc_count = 0;
23698  ctx->enc_type = 0;
23699  ctx->is_complex = 0;
23700  ctx->is_valid_array = 0;
23701  ctx->struct_alignment = 0;
23702  while (type->typegroup == 'S') {
23703  ++ctx->head;
23704  ctx->head->field = type->fields;
23705  ctx->head->parent_offset = 0;
23706  type = type->fields->type;
23707  }
23708 }
23709 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
23710  int count;
23711  const char* t = *ts;
23712  if (*t < '0' || *t > '9') {
23713  return -1;
23714  } else {
23715  count = *t++ - '0';
23716  while (*t >= '0' && *t <= '9') {
23717  count *= 10;
23718  count += *t++ - '0';
23719  }
23720  }
23721  *ts = t;
23722  return count;
23723 }
23724 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
23725  int number = __Pyx_BufFmt_ParseNumber(ts);
23726  if (number == -1)
23727  PyErr_Format(PyExc_ValueError,\
23728  "Does not understand character buffer dtype format string ('%c')", **ts);
23729  return number;
23730 }
23731 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
23732  PyErr_Format(PyExc_ValueError,
23733  "Unexpected format string character: '%c'", ch);
23734 }
23735 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
23736  switch (ch) {
23737  case '?': return "'bool'";
23738  case 'c': return "'char'";
23739  case 'b': return "'signed char'";
23740  case 'B': return "'unsigned char'";
23741  case 'h': return "'short'";
23742  case 'H': return "'unsigned short'";
23743  case 'i': return "'int'";
23744  case 'I': return "'unsigned int'";
23745  case 'l': return "'long'";
23746  case 'L': return "'unsigned long'";
23747  case 'q': return "'long long'";
23748  case 'Q': return "'unsigned long long'";
23749  case 'f': return (is_complex ? "'complex float'" : "'float'");
23750  case 'd': return (is_complex ? "'complex double'" : "'double'");
23751  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
23752  case 'T': return "a struct";
23753  case 'O': return "Python object";
23754  case 'P': return "a pointer";
23755  case 's': case 'p': return "a string";
23756  case 0: return "end";
23757  default: return "unparseable format string";
23758  }
23759 }
23760 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
23761  switch (ch) {
23762  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23763  case 'h': case 'H': return 2;
23764  case 'i': case 'I': case 'l': case 'L': return 4;
23765  case 'q': case 'Q': return 8;
23766  case 'f': return (is_complex ? 8 : 4);
23767  case 'd': return (is_complex ? 16 : 8);
23768  case 'g': {
23769  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
23770  return 0;
23771  }
23772  case 'O': case 'P': return sizeof(void*);
23773  default:
23774  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23775  return 0;
23776  }
23777 }
23778 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
23779  switch (ch) {
23780  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23781  case 'h': case 'H': return sizeof(short);
23782  case 'i': case 'I': return sizeof(int);
23783  case 'l': case 'L': return sizeof(long);
23784  #ifdef HAVE_LONG_LONG
23785  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
23786  #endif
23787  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
23788  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
23789  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
23790  case 'O': case 'P': return sizeof(void*);
23791  default: {
23792  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23793  return 0;
23794  }
23795  }
23796 }
23797 typedef struct { char c; short x; } __Pyx_st_short;
23798 typedef struct { char c; int x; } __Pyx_st_int;
23799 typedef struct { char c; long x; } __Pyx_st_long;
23800 typedef struct { char c; float x; } __Pyx_st_float;
23801 typedef struct { char c; double x; } __Pyx_st_double;
23802 typedef struct { char c; long double x; } __Pyx_st_longdouble;
23803 typedef struct { char c; void *x; } __Pyx_st_void_p;
23804 #ifdef HAVE_LONG_LONG
23805 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
23806 #endif
23807 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
23808  switch (ch) {
23809  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23810  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
23811  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
23812  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
23813 #ifdef HAVE_LONG_LONG
23814  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
23815 #endif
23816  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
23817  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
23818  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
23819  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
23820  default:
23821  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23822  return 0;
23823  }
23824 }
23825 /* These are for computing the padding at the end of the struct to align
23826  on the first member of the struct. This will probably the same as above,
23827  but we don't have any guarantees.
23828  */
23829 typedef struct { short x; char c; } __Pyx_pad_short;
23830 typedef struct { int x; char c; } __Pyx_pad_int;
23831 typedef struct { long x; char c; } __Pyx_pad_long;
23832 typedef struct { float x; char c; } __Pyx_pad_float;
23833 typedef struct { double x; char c; } __Pyx_pad_double;
23834 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
23835 typedef struct { void *x; char c; } __Pyx_pad_void_p;
23836 #ifdef HAVE_LONG_LONG
23837 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
23838 #endif
23839 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
23840  switch (ch) {
23841  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23842  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
23843  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
23844  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
23845 #ifdef HAVE_LONG_LONG
23846  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
23847 #endif
23848  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
23849  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
23850  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
23851  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
23852  default:
23853  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23854  return 0;
23855  }
23856 }
23857 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
23858  switch (ch) {
23859  case 'c':
23860  return 'H';
23861  case 'b': case 'h': case 'i':
23862  case 'l': case 'q': case 's': case 'p':
23863  return 'I';
23864  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
23865  return 'U';
23866  case 'f': case 'd': case 'g':
23867  return (is_complex ? 'C' : 'R');
23868  case 'O':
23869  return 'O';
23870  case 'P':
23871  return 'P';
23872  default: {
23873  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23874  return 0;
23875  }
23876  }
23877 }
23878 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
23879  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
23880  const char* expected;
23881  const char* quote;
23882  if (ctx->head == NULL) {
23883  expected = "end";
23884  quote = "";
23885  } else {
23886  expected = ctx->head->field->type->name;
23887  quote = "'";
23888  }
23889  PyErr_Format(PyExc_ValueError,
23890  "Buffer dtype mismatch, expected %s%s%s but got %s",
23891  quote, expected, quote,
23892  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
23893  } else {
23894  __Pyx_StructField* field = ctx->head->field;
23895  __Pyx_StructField* parent = (ctx->head - 1)->field;
23896  PyErr_Format(PyExc_ValueError,
23897  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
23898  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
23899  parent->type->name, field->name);
23900  }
23901 }
23902 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
23903  char group;
23904  size_t size, offset, arraysize = 1;
23905  if (ctx->enc_type == 0) return 0;
23906  if (ctx->head->field->type->arraysize[0]) {
23907  int i, ndim = 0;
23908  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
23909  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
23910  ndim = 1;
23911  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
23912  PyErr_Format(PyExc_ValueError,
23913  "Expected a dimension of size %zu, got %zu",
23914  ctx->head->field->type->arraysize[0], ctx->enc_count);
23915  return -1;
23916  }
23917  }
23918  if (!ctx->is_valid_array) {
23919  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
23920  ctx->head->field->type->ndim, ndim);
23921  return -1;
23922  }
23923  for (i = 0; i < ctx->head->field->type->ndim; i++) {
23924  arraysize *= ctx->head->field->type->arraysize[i];
23925  }
23926  ctx->is_valid_array = 0;
23927  ctx->enc_count = 1;
23928  }
23929  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
23930  do {
23931  __Pyx_StructField* field = ctx->head->field;
23932  __Pyx_TypeInfo* type = field->type;
23933  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
23934  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
23935  } else {
23936  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
23937  }
23938  if (ctx->enc_packmode == '@') {
23939  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
23940  size_t align_mod_offset;
23941  if (align_at == 0) return -1;
23942  align_mod_offset = ctx->fmt_offset % align_at;
23943  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
23944  if (ctx->struct_alignment == 0)
23945  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
23946  ctx->is_complex);
23947  }
23948  if (type->size != size || type->typegroup != group) {
23949  if (type->typegroup == 'C' && type->fields != NULL) {
23950  size_t parent_offset = ctx->head->parent_offset + field->offset;
23951  ++ctx->head;
23952  ctx->head->field = type->fields;
23953  ctx->head->parent_offset = parent_offset;
23954  continue;
23955  }
23956  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
23957  } else {
23958  __Pyx_BufFmt_RaiseExpected(ctx);
23959  return -1;
23960  }
23961  }
23962  offset = ctx->head->parent_offset + field->offset;
23963  if (ctx->fmt_offset != offset) {
23964  PyErr_Format(PyExc_ValueError,
23965  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
23966  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
23967  return -1;
23968  }
23969  ctx->fmt_offset += size;
23970  if (arraysize)
23971  ctx->fmt_offset += (arraysize - 1) * size;
23972  --ctx->enc_count;
23973  while (1) {
23974  if (field == &ctx->root) {
23975  ctx->head = NULL;
23976  if (ctx->enc_count != 0) {
23977  __Pyx_BufFmt_RaiseExpected(ctx);
23978  return -1;
23979  }
23980  break;
23981  }
23982  ctx->head->field = ++field;
23983  if (field->type == NULL) {
23984  --ctx->head;
23985  field = ctx->head->field;
23986  continue;
23987  } else if (field->type->typegroup == 'S') {
23988  size_t parent_offset = ctx->head->parent_offset + field->offset;
23989  if (field->type->fields->type == NULL) continue;
23990  field = field->type->fields;
23991  ++ctx->head;
23992  ctx->head->field = field;
23993  ctx->head->parent_offset = parent_offset;
23994  break;
23995  } else {
23996  break;
23997  }
23998  }
23999  } while (ctx->enc_count);
24000  ctx->enc_type = 0;
24001  ctx->is_complex = 0;
24002  return 0;
24003 }
24004 static PyObject *
24005 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24006 {
24007  const char *ts = *tsp;
24008  int i = 0, number, ndim;
24009  ++ts;
24010  if (ctx->new_count != 1) {
24011  PyErr_SetString(PyExc_ValueError,
24012  "Cannot handle repeated arrays in format string");
24013  return NULL;
24014  }
24015  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24016  ndim = ctx->head->field->type->ndim;
24017  while (*ts && *ts != ')') {
24018  switch (*ts) {
24019  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
24020  default: break;
24021  }
24022  number = __Pyx_BufFmt_ExpectNumber(&ts);
24023  if (number == -1) return NULL;
24024  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24025  return PyErr_Format(PyExc_ValueError,
24026  "Expected a dimension of size %zu, got %d",
24027  ctx->head->field->type->arraysize[i], number);
24028  if (*ts != ',' && *ts != ')')
24029  return PyErr_Format(PyExc_ValueError,
24030  "Expected a comma in format string, got '%c'", *ts);
24031  if (*ts == ',') ts++;
24032  i++;
24033  }
24034  if (i != ndim)
24035  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24036  ctx->head->field->type->ndim, i);
24037  if (!*ts) {
24038  PyErr_SetString(PyExc_ValueError,
24039  "Unexpected end of format string, expected ')'");
24040  return NULL;
24041  }
24042  ctx->is_valid_array = 1;
24043  ctx->new_count = 1;
24044  *tsp = ++ts;
24045  return Py_None;
24046 }
24047 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24048  int got_Z = 0;
24049  while (1) {
24050  switch(*ts) {
24051  case 0:
24052  if (ctx->enc_type != 0 && ctx->head == NULL) {
24053  __Pyx_BufFmt_RaiseExpected(ctx);
24054  return NULL;
24055  }
24056  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24057  if (ctx->head != NULL) {
24058  __Pyx_BufFmt_RaiseExpected(ctx);
24059  return NULL;
24060  }
24061  return ts;
24062  case ' ':
24063  case '\r':
24064  case '\n':
24065  ++ts;
24066  break;
24067  case '<':
24068  if (!__Pyx_Is_Little_Endian()) {
24069  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24070  return NULL;
24071  }
24072  ctx->new_packmode = '=';
24073  ++ts;
24074  break;
24075  case '>':
24076  case '!':
24077  if (__Pyx_Is_Little_Endian()) {
24078  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24079  return NULL;
24080  }
24081  ctx->new_packmode = '=';
24082  ++ts;
24083  break;
24084  case '=':
24085  case '@':
24086  case '^':
24087  ctx->new_packmode = *ts++;
24088  break;
24089  case 'T':
24090  {
24091  const char* ts_after_sub;
24092  size_t i, struct_count = ctx->new_count;
24093  size_t struct_alignment = ctx->struct_alignment;
24094  ctx->new_count = 1;
24095  ++ts;
24096  if (*ts != '{') {
24097  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24098  return NULL;
24099  }
24100  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24101  ctx->enc_type = 0;
24102  ctx->enc_count = 0;
24103  ctx->struct_alignment = 0;
24104  ++ts;
24105  ts_after_sub = ts;
24106  for (i = 0; i != struct_count; ++i) {
24107  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24108  if (!ts_after_sub) return NULL;
24109  }
24110  ts = ts_after_sub;
24111  if (struct_alignment) ctx->struct_alignment = struct_alignment;
24112  }
24113  break;
24114  case '}':
24115  {
24116  size_t alignment = ctx->struct_alignment;
24117  ++ts;
24118  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24119  ctx->enc_type = 0;
24120  if (alignment && ctx->fmt_offset % alignment) {
24121  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24122  }
24123  }
24124  return ts;
24125  case 'x':
24126  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24127  ctx->fmt_offset += ctx->new_count;
24128  ctx->new_count = 1;
24129  ctx->enc_count = 0;
24130  ctx->enc_type = 0;
24131  ctx->enc_packmode = ctx->new_packmode;
24132  ++ts;
24133  break;
24134  case 'Z':
24135  got_Z = 1;
24136  ++ts;
24137  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
24138  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
24139  return NULL;
24140  }
24141  CYTHON_FALLTHROUGH;
24142  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
24143  case 'l': case 'L': case 'q': case 'Q':
24144  case 'f': case 'd': case 'g':
24145  case 'O': case 'p':
24146  if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
24147  (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
24148  ctx->enc_count += ctx->new_count;
24149  ctx->new_count = 1;
24150  got_Z = 0;
24151  ++ts;
24152  break;
24153  }
24154  CYTHON_FALLTHROUGH;
24155  case 's':
24156  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24157  ctx->enc_count = ctx->new_count;
24158  ctx->enc_packmode = ctx->new_packmode;
24159  ctx->enc_type = *ts;
24160  ctx->is_complex = got_Z;
24161  ++ts;
24162  ctx->new_count = 1;
24163  got_Z = 0;
24164  break;
24165  case ':':
24166  ++ts;
24167  while(*ts != ':') ++ts;
24168  ++ts;
24169  break;
24170  case '(':
24171  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
24172  break;
24173  default:
24174  {
24175  int number = __Pyx_BufFmt_ExpectNumber(&ts);
24176  if (number == -1) return NULL;
24177  ctx->new_count = (size_t)number;
24178  }
24179  }
24180  }
24181 }
24182 
24183 /* BufferGetAndValidate */
24184  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
24185  if (unlikely(info->buf == NULL)) return;
24186  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
24187  __Pyx_ReleaseBuffer(info);
24188 }
24189 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
24190  buf->buf = NULL;
24191  buf->obj = NULL;
24192  buf->strides = __Pyx_zeros;
24193  buf->shape = __Pyx_zeros;
24194  buf->suboffsets = __Pyx_minusones;
24195 }
24196 static int __Pyx__GetBufferAndValidate(
24197  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
24198  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
24199 {
24200  buf->buf = NULL;
24201  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
24202  __Pyx_ZeroBuffer(buf);
24203  return -1;
24204  }
24205  if (unlikely(buf->ndim != nd)) {
24206  PyErr_Format(PyExc_ValueError,
24207  "Buffer has wrong number of dimensions (expected %d, got %d)",
24208  nd, buf->ndim);
24209  goto fail;
24210  }
24211  if (!cast) {
24212  __Pyx_BufFmt_Context ctx;
24213  __Pyx_BufFmt_Init(&ctx, stack, dtype);
24214  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
24215  }
24216  if (unlikely((size_t)buf->itemsize != dtype->size)) {
24217  PyErr_Format(PyExc_ValueError,
24218  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
24219  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
24220  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
24221  goto fail;
24222  }
24223  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
24224  return 0;
24225 fail:;
24226  __Pyx_SafeReleaseBuffer(buf);
24227  return -1;
24228 }
24229 
24230 /* BufferIndexError */
24231  static void __Pyx_RaiseBufferIndexError(int axis) {
24232  PyErr_Format(PyExc_IndexError,
24233  "Out of bounds on buffer access (axis %d)", axis);
24234 }
24235 
24236 /* PyErrFetchRestore */
24237  #if CYTHON_FAST_THREAD_STATE
24238 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24239  PyObject *tmp_type, *tmp_value, *tmp_tb;
24240  tmp_type = tstate->curexc_type;
24241  tmp_value = tstate->curexc_value;
24242  tmp_tb = tstate->curexc_traceback;
24243  tstate->curexc_type = type;
24244  tstate->curexc_value = value;
24245  tstate->curexc_traceback = tb;
24246  Py_XDECREF(tmp_type);
24247  Py_XDECREF(tmp_value);
24248  Py_XDECREF(tmp_tb);
24249 }
24250 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24251  *type = tstate->curexc_type;
24252  *value = tstate->curexc_value;
24253  *tb = tstate->curexc_traceback;
24254  tstate->curexc_type = 0;
24255  tstate->curexc_value = 0;
24256  tstate->curexc_traceback = 0;
24257 }
24258 #endif
24259 
24260 /* DictGetItem */
24261  #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
24262 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
24263  PyObject *value;
24264  value = PyDict_GetItemWithError(d, key);
24265  if (unlikely(!value)) {
24266  if (!PyErr_Occurred()) {
24267  if (unlikely(PyTuple_Check(key))) {
24268  PyObject* args = PyTuple_Pack(1, key);
24269  if (likely(args)) {
24270  PyErr_SetObject(PyExc_KeyError, args);
24271  Py_DECREF(args);
24272  }
24273  } else {
24274  PyErr_SetObject(PyExc_KeyError, key);
24275  }
24276  }
24277  return NULL;
24278  }
24279  Py_INCREF(value);
24280  return value;
24281 }
24282 #endif
24283 
24284 /* GetItemInt */
24285  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24286  PyObject *r;
24287  if (!j) return NULL;
24288  r = PyObject_GetItem(o, j);
24289  Py_DECREF(j);
24290  return r;
24291 }
24292 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24293  CYTHON_NCP_UNUSED int wraparound,
24294  CYTHON_NCP_UNUSED int boundscheck) {
24295 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24296  Py_ssize_t wrapped_i = i;
24297  if (wraparound & unlikely(i < 0)) {
24298  wrapped_i += PyList_GET_SIZE(o);
24299  }
24300  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
24301  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
24302  Py_INCREF(r);
24303  return r;
24304  }
24305  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24306 #else
24307  return PySequence_GetItem(o, i);
24308 #endif
24309 }
24310 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24311  CYTHON_NCP_UNUSED int wraparound,
24312  CYTHON_NCP_UNUSED int boundscheck) {
24313 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24314  Py_ssize_t wrapped_i = i;
24315  if (wraparound & unlikely(i < 0)) {
24316  wrapped_i += PyTuple_GET_SIZE(o);
24317  }
24318  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
24319  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
24320  Py_INCREF(r);
24321  return r;
24322  }
24323  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24324 #else
24325  return PySequence_GetItem(o, i);
24326 #endif
24327 }
24328 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
24329  CYTHON_NCP_UNUSED int wraparound,
24330  CYTHON_NCP_UNUSED int boundscheck) {
24331 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
24332  if (is_list || PyList_CheckExact(o)) {
24333  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24334  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
24335  PyObject *r = PyList_GET_ITEM(o, n);
24336  Py_INCREF(r);
24337  return r;
24338  }
24339  }
24340  else if (PyTuple_CheckExact(o)) {
24341  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24342  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
24343  PyObject *r = PyTuple_GET_ITEM(o, n);
24344  Py_INCREF(r);
24345  return r;
24346  }
24347  } else {
24348  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
24349  if (likely(m && m->sq_item)) {
24350  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
24351  Py_ssize_t l = m->sq_length(o);
24352  if (likely(l >= 0)) {
24353  i += l;
24354  } else {
24355  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24356  return NULL;
24357  PyErr_Clear();
24358  }
24359  }
24360  return m->sq_item(o, i);
24361  }
24362  }
24363 #else
24364  if (is_list || PySequence_Check(o)) {
24365  return PySequence_GetItem(o, i);
24366  }
24367 #endif
24368  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24369 }
24370 
24371 /* ObjectGetItem */
24372  #if CYTHON_USE_TYPE_SLOTS
24373 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
24374  PyObject *runerr;
24375  Py_ssize_t key_value;
24376  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
24377  if (unlikely(!(m && m->sq_item))) {
24378  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
24379  return NULL;
24380  }
24381  key_value = __Pyx_PyIndex_AsSsize_t(index);
24382  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24383  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24384  }
24385  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24386  PyErr_Clear();
24387  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
24388  }
24389  return NULL;
24390 }
24391 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
24392  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
24393  if (likely(m && m->mp_subscript)) {
24394  return m->mp_subscript(obj, key);
24395  }
24396  return __Pyx_PyObject_GetIndex(obj, key);
24397 }
24398 #endif
24399 
24400 /* PyFloatBinop */
24401  #if !CYTHON_COMPILING_IN_PYPY
24402 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
24403  const double b = floatval;
24404  double a, result;
24405  (void)inplace;
24406  (void)zerodivision_check;
24407  if (likely(PyFloat_CheckExact(op1))) {
24408  a = PyFloat_AS_DOUBLE(op1);
24409 
24410  } else
24411  #if PY_MAJOR_VERSION < 3
24412  if (likely(PyInt_CheckExact(op1))) {
24413  a = (double) PyInt_AS_LONG(op1);
24414 
24415  } else
24416  #endif
24417  if (likely(PyLong_CheckExact(op1))) {
24418  #if CYTHON_USE_PYLONG_INTERNALS
24419  const digit* digits = ((PyLongObject*)op1)->ob_digit;
24420  const Py_ssize_t size = Py_SIZE(op1);
24421  switch (size) {
24422  case 0: a = 0.0; break;
24423  case -1: a = -(double) digits[0]; break;
24424  case 1: a = (double) digits[0]; break;
24425  case -2:
24426  case 2:
24427  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
24428  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24429  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
24430  if (size == -2)
24431  a = -a;
24432  break;
24433  }
24434  }
24435  CYTHON_FALLTHROUGH;
24436  case -3:
24437  case 3:
24438  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
24439  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24440  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
24441  if (size == -3)
24442  a = -a;
24443  break;
24444  }
24445  }
24446  CYTHON_FALLTHROUGH;
24447  case -4:
24448  case 4:
24449  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
24450  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24451  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
24452  if (size == -4)
24453  a = -a;
24454  break;
24455  }
24456  }
24457  CYTHON_FALLTHROUGH;
24458  default:
24459  #else
24460  {
24461  #endif
24462  a = PyLong_AsDouble(op1);
24463  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
24464 
24465  }
24466  } else {
24467  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24468  }
24469 
24470  PyFPE_START_PROTECT("add", return NULL)
24471  result = a + b;
24472  PyFPE_END_PROTECT(result)
24473  return PyFloat_FromDouble(result);
24474 }
24475 #endif
24476 
24477 /* PyFunctionFastCall */
24478  #if CYTHON_FAST_PYCALL
24479 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
24480  PyObject *globals) {
24481  PyFrameObject *f;
24482  PyThreadState *tstate = __Pyx_PyThreadState_Current;
24483  PyObject **fastlocals;
24484  Py_ssize_t i;
24485  PyObject *result;
24486  assert(globals != NULL);
24487  /* XXX Perhaps we should create a specialized
24488  PyFrame_New() that doesn't take locals, but does
24489  take builtins without sanity checking them.
24490  */
24491  assert(tstate != NULL);
24492  f = PyFrame_New(tstate, co, globals, NULL);
24493  if (f == NULL) {
24494  return NULL;
24495  }
24496  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
24497  for (i = 0; i < na; i++) {
24498  Py_INCREF(*args);
24499  fastlocals[i] = *args++;
24500  }
24501  result = PyEval_EvalFrameEx(f,0);
24502  ++tstate->recursion_depth;
24503  Py_DECREF(f);
24504  --tstate->recursion_depth;
24505  return result;
24506 }
24507 #if 1 || PY_VERSION_HEX < 0x030600B1
24508 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
24509  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
24510  PyObject *globals = PyFunction_GET_GLOBALS(func);
24511  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
24512  PyObject *closure;
24513 #if PY_MAJOR_VERSION >= 3
24514  PyObject *kwdefs;
24515 #endif
24516  PyObject *kwtuple, **k;
24517  PyObject **d;
24518  Py_ssize_t nd;
24519  Py_ssize_t nk;
24520  PyObject *result;
24521  assert(kwargs == NULL || PyDict_Check(kwargs));
24522  nk = kwargs ? PyDict_Size(kwargs) : 0;
24523  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
24524  return NULL;
24525  }
24526  if (
24527 #if PY_MAJOR_VERSION >= 3
24528  co->co_kwonlyargcount == 0 &&
24529 #endif
24530  likely(kwargs == NULL || nk == 0) &&
24531  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
24532  if (argdefs == NULL && co->co_argcount == nargs) {
24533  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
24534  goto done;
24535  }
24536  else if (nargs == 0 && argdefs != NULL
24537  && co->co_argcount == Py_SIZE(argdefs)) {
24538  /* function called with no arguments, but all parameters have
24539  a default value: use default values as arguments .*/
24540  args = &PyTuple_GET_ITEM(argdefs, 0);
24541  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
24542  goto done;
24543  }
24544  }
24545  if (kwargs != NULL) {
24546  Py_ssize_t pos, i;
24547  kwtuple = PyTuple_New(2 * nk);
24548  if (kwtuple == NULL) {
24549  result = NULL;
24550  goto done;
24551  }
24552  k = &PyTuple_GET_ITEM(kwtuple, 0);
24553  pos = i = 0;
24554  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
24555  Py_INCREF(k[i]);
24556  Py_INCREF(k[i+1]);
24557  i += 2;
24558  }
24559  nk = i / 2;
24560  }
24561  else {
24562  kwtuple = NULL;
24563  k = NULL;
24564  }
24565  closure = PyFunction_GET_CLOSURE(func);
24566 #if PY_MAJOR_VERSION >= 3
24567  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
24568 #endif
24569  if (argdefs != NULL) {
24570  d = &PyTuple_GET_ITEM(argdefs, 0);
24571  nd = Py_SIZE(argdefs);
24572  }
24573  else {
24574  d = NULL;
24575  nd = 0;
24576  }
24577 #if PY_MAJOR_VERSION >= 3
24578  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
24579  args, (int)nargs,
24580  k, (int)nk,
24581  d, (int)nd, kwdefs, closure);
24582 #else
24583  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
24584  args, (int)nargs,
24585  k, (int)nk,
24586  d, (int)nd, closure);
24587 #endif
24588  Py_XDECREF(kwtuple);
24589 done:
24590  Py_LeaveRecursiveCall();
24591  return result;
24592 }
24593 #endif
24594 #endif
24595 
24596 /* PyCFunctionFastCall */
24597  #if CYTHON_FAST_PYCCALL
24598 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
24599  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
24600  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
24601  PyObject *self = PyCFunction_GET_SELF(func);
24602  int flags = PyCFunction_GET_FLAGS(func);
24603  assert(PyCFunction_Check(func));
24604  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
24605  assert(nargs >= 0);
24606  assert(nargs == 0 || args != NULL);
24607  /* _PyCFunction_FastCallDict() must not be called with an exception set,
24608  because it may clear it (directly or indirectly) and so the
24609  caller loses its exception */
24610  assert(!PyErr_Occurred());
24611  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
24612  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
24613  } else {
24614  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
24615  }
24616 }
24617 #endif
24618 
24619 /* PyObjectCall */
24620  #if CYTHON_COMPILING_IN_CPYTHON
24621 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
24622  PyObject *result;
24623  ternaryfunc call = Py_TYPE(func)->tp_call;
24624  if (unlikely(!call))
24625  return PyObject_Call(func, arg, kw);
24626  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24627  return NULL;
24628  result = (*call)(func, arg, kw);
24629  Py_LeaveRecursiveCall();
24630  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24631  PyErr_SetString(
24632  PyExc_SystemError,
24633  "NULL result without error in PyObject_Call");
24634  }
24635  return result;
24636 }
24637 #endif
24638 
24639 /* PyDictVersioning */
24640  #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
24641 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
24642  PyObject *dict = Py_TYPE(obj)->tp_dict;
24643  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
24644 }
24645 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
24646  PyObject **dictptr = NULL;
24647  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
24648  if (offset) {
24649 #if CYTHON_COMPILING_IN_CPYTHON
24650  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
24651 #else
24652  dictptr = _PyObject_GetDictPtr(obj);
24653 #endif
24654  }
24655  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24656 }
24657 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24658  PyObject *dict = Py_TYPE(obj)->tp_dict;
24659  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24660  return 0;
24661  return obj_dict_version == __Pyx_get_object_dict_version(obj);
24662 }
24663 #endif
24664 
24665 /* GetModuleGlobalName */
24666  #if CYTHON_USE_DICT_VERSIONS
24667 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24668 #else
24669 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24670 #endif
24671 {
24672  PyObject *result;
24673 #if !CYTHON_AVOID_BORROWED_REFS
24674 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
24675  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24676  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24677  if (likely(result)) {
24678  return __Pyx_NewRef(result);
24679  } else if (unlikely(PyErr_Occurred())) {
24680  return NULL;
24681  }
24682 #else
24683  result = PyDict_GetItem(__pyx_d, name);
24684  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24685  if (likely(result)) {
24686  return __Pyx_NewRef(result);
24687  }
24688 #endif
24689 #else
24690  result = PyObject_GetItem(__pyx_d, name);
24691  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24692  if (likely(result)) {
24693  return __Pyx_NewRef(result);
24694  }
24695  PyErr_Clear();
24696 #endif
24697  return __Pyx_GetBuiltinName(name);
24698 }
24699 
24700 /* ExtTypeTest */
24701  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
24702  if (unlikely(!type)) {
24703  PyErr_SetString(PyExc_SystemError, "Missing type object");
24704  return 0;
24705  }
24706  if (likely(__Pyx_TypeCheck(obj, type)))
24707  return 1;
24708  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
24709  Py_TYPE(obj)->tp_name, type->tp_name);
24710  return 0;
24711 }
24712 
24713 /* PyObjectCall2Args */
24714  static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
24715  PyObject *args, *result = NULL;
24716  #if CYTHON_FAST_PYCALL
24717  if (PyFunction_Check(function)) {
24718  PyObject *args[2] = {arg1, arg2};
24719  return __Pyx_PyFunction_FastCall(function, args, 2);
24720  }
24721  #endif
24722  #if CYTHON_FAST_PYCCALL
24723  if (__Pyx_PyFastCFunction_Check(function)) {
24724  PyObject *args[2] = {arg1, arg2};
24725  return __Pyx_PyCFunction_FastCall(function, args, 2);
24726  }
24727  #endif
24728  args = PyTuple_New(2);
24729  if (unlikely(!args)) goto done;
24730  Py_INCREF(arg1);
24731  PyTuple_SET_ITEM(args, 0, arg1);
24732  Py_INCREF(arg2);
24733  PyTuple_SET_ITEM(args, 1, arg2);
24734  Py_INCREF(function);
24735  result = __Pyx_PyObject_Call(function, args, NULL);
24736  Py_DECREF(args);
24737  Py_DECREF(function);
24738 done:
24739  return result;
24740 }
24741 
24742 /* PyObjectCallMethO */
24743  #if CYTHON_COMPILING_IN_CPYTHON
24744 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
24745  PyObject *self, *result;
24746  PyCFunction cfunc;
24747  cfunc = PyCFunction_GET_FUNCTION(func);
24748  self = PyCFunction_GET_SELF(func);
24749  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24750  return NULL;
24751  result = cfunc(self, arg);
24752  Py_LeaveRecursiveCall();
24753  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24754  PyErr_SetString(
24755  PyExc_SystemError,
24756  "NULL result without error in PyObject_Call");
24757  }
24758  return result;
24759 }
24760 #endif
24761 
24762 /* PyObjectCallOneArg */
24763  #if CYTHON_COMPILING_IN_CPYTHON
24764 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24765  PyObject *result;
24766  PyObject *args = PyTuple_New(1);
24767  if (unlikely(!args)) return NULL;
24768  Py_INCREF(arg);
24769  PyTuple_SET_ITEM(args, 0, arg);
24770  result = __Pyx_PyObject_Call(func, args, NULL);
24771  Py_DECREF(args);
24772  return result;
24773 }
24774 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24775 #if CYTHON_FAST_PYCALL
24776  if (PyFunction_Check(func)) {
24777  return __Pyx_PyFunction_FastCall(func, &arg, 1);
24778  }
24779 #endif
24780  if (likely(PyCFunction_Check(func))) {
24781  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
24782  return __Pyx_PyObject_CallMethO(func, arg);
24783 #if CYTHON_FAST_PYCCALL
24784  } else if (__Pyx_PyFastCFunction_Check(func)) {
24785  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
24786 #endif
24787  }
24788  }
24789  return __Pyx__PyObject_CallOneArg(func, arg);
24790 }
24791 #else
24792 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24793  PyObject *result;
24794  PyObject *args = PyTuple_Pack(1, arg);
24795  if (unlikely(!args)) return NULL;
24796  result = __Pyx_PyObject_Call(func, args, NULL);
24797  Py_DECREF(args);
24798  return result;
24799 }
24800 #endif
24801 
24802 /* pyobject_as_double */
24803  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
24804  PyObject* float_value;
24805 #if !CYTHON_USE_TYPE_SLOTS
24806  float_value = PyNumber_Float(obj); if ((0)) goto bad;
24807 #else
24808  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
24809  if (likely(nb) && likely(nb->nb_float)) {
24810  float_value = nb->nb_float(obj);
24811  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
24812  PyErr_Format(PyExc_TypeError,
24813  "__float__ returned non-float (type %.200s)",
24814  Py_TYPE(float_value)->tp_name);
24815  Py_DECREF(float_value);
24816  goto bad;
24817  }
24818  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
24819 #if PY_MAJOR_VERSION >= 3
24820  float_value = PyFloat_FromString(obj);
24821 #else
24822  float_value = PyFloat_FromString(obj, 0);
24823 #endif
24824  } else {
24825  PyObject* args = PyTuple_New(1);
24826  if (unlikely(!args)) goto bad;
24827  PyTuple_SET_ITEM(args, 0, obj);
24828  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
24829  PyTuple_SET_ITEM(args, 0, 0);
24830  Py_DECREF(args);
24831  }
24832 #endif
24833  if (likely(float_value)) {
24834  double value = PyFloat_AS_DOUBLE(float_value);
24835  Py_DECREF(float_value);
24836  return value;
24837  }
24838 bad:
24839  return (double)-1;
24840 }
24841 
24842 /* GetTopmostException */
24843  #if CYTHON_USE_EXC_INFO_STACK
24844 static _PyErr_StackItem *
24845 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
24846 {
24847  _PyErr_StackItem *exc_info = tstate->exc_info;
24848  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
24849  exc_info->previous_item != NULL)
24850  {
24851  exc_info = exc_info->previous_item;
24852  }
24853  return exc_info;
24854 }
24855 #endif
24856 
24857 /* SaveResetException */
24858  #if CYTHON_FAST_THREAD_STATE
24859 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24860  #if CYTHON_USE_EXC_INFO_STACK
24861  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24862  *type = exc_info->exc_type;
24863  *value = exc_info->exc_value;
24864  *tb = exc_info->exc_traceback;
24865  #else
24866  *type = tstate->exc_type;
24867  *value = tstate->exc_value;
24868  *tb = tstate->exc_traceback;
24869  #endif
24870  Py_XINCREF(*type);
24871  Py_XINCREF(*value);
24872  Py_XINCREF(*tb);
24873 }
24874 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24875  PyObject *tmp_type, *tmp_value, *tmp_tb;
24876  #if CYTHON_USE_EXC_INFO_STACK
24877  _PyErr_StackItem *exc_info = tstate->exc_info;
24878  tmp_type = exc_info->exc_type;
24879  tmp_value = exc_info->exc_value;
24880  tmp_tb = exc_info->exc_traceback;
24881  exc_info->exc_type = type;
24882  exc_info->exc_value = value;
24883  exc_info->exc_traceback = tb;
24884  #else
24885  tmp_type = tstate->exc_type;
24886  tmp_value = tstate->exc_value;
24887  tmp_tb = tstate->exc_traceback;
24888  tstate->exc_type = type;
24889  tstate->exc_value = value;
24890  tstate->exc_traceback = tb;
24891  #endif
24892  Py_XDECREF(tmp_type);
24893  Py_XDECREF(tmp_value);
24894  Py_XDECREF(tmp_tb);
24895 }
24896 #endif
24897 
24898 /* PyErrExceptionMatches */
24899  #if CYTHON_FAST_THREAD_STATE
24900 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24901  Py_ssize_t i, n;
24902  n = PyTuple_GET_SIZE(tuple);
24903 #if PY_MAJOR_VERSION >= 3
24904  for (i=0; i<n; i++) {
24905  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
24906  }
24907 #endif
24908  for (i=0; i<n; i++) {
24909  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
24910  }
24911  return 0;
24912 }
24913 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
24914  PyObject *exc_type = tstate->curexc_type;
24915  if (exc_type == err) return 1;
24916  if (unlikely(!exc_type)) return 0;
24917  if (unlikely(PyTuple_Check(err)))
24918  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
24919  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
24920 }
24921 #endif
24922 
24923 /* GetException */
24924  #if CYTHON_FAST_THREAD_STATE
24925 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
24926 #else
24927 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
24928 #endif
24929 {
24930  PyObject *local_type, *local_value, *local_tb;
24931 #if CYTHON_FAST_THREAD_STATE
24932  PyObject *tmp_type, *tmp_value, *tmp_tb;
24933  local_type = tstate->curexc_type;
24934  local_value = tstate->curexc_value;
24935  local_tb = tstate->curexc_traceback;
24936  tstate->curexc_type = 0;
24937  tstate->curexc_value = 0;
24938  tstate->curexc_traceback = 0;
24939 #else
24940  PyErr_Fetch(&local_type, &local_value, &local_tb);
24941 #endif
24942  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
24943 #if CYTHON_FAST_THREAD_STATE
24944  if (unlikely(tstate->curexc_type))
24945 #else
24946  if (unlikely(PyErr_Occurred()))
24947 #endif
24948  goto bad;
24949  #if PY_MAJOR_VERSION >= 3
24950  if (local_tb) {
24951  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
24952  goto bad;
24953  }
24954  #endif
24955  Py_XINCREF(local_tb);
24956  Py_XINCREF(local_type);
24957  Py_XINCREF(local_value);
24958  *type = local_type;
24959  *value = local_value;
24960  *tb = local_tb;
24961 #if CYTHON_FAST_THREAD_STATE
24962  #if CYTHON_USE_EXC_INFO_STACK
24963  {
24964  _PyErr_StackItem *exc_info = tstate->exc_info;
24965  tmp_type = exc_info->exc_type;
24966  tmp_value = exc_info->exc_value;
24967  tmp_tb = exc_info->exc_traceback;
24968  exc_info->exc_type = local_type;
24969  exc_info->exc_value = local_value;
24970  exc_info->exc_traceback = local_tb;
24971  }
24972  #else
24973  tmp_type = tstate->exc_type;
24974  tmp_value = tstate->exc_value;
24975  tmp_tb = tstate->exc_traceback;
24976  tstate->exc_type = local_type;
24977  tstate->exc_value = local_value;
24978  tstate->exc_traceback = local_tb;
24979  #endif
24980  Py_XDECREF(tmp_type);
24981  Py_XDECREF(tmp_value);
24982  Py_XDECREF(tmp_tb);
24983 #else
24984  PyErr_SetExcInfo(local_type, local_value, local_tb);
24985 #endif
24986  return 0;
24987 bad:
24988  *type = 0;
24989  *value = 0;
24990  *tb = 0;
24991  Py_XDECREF(local_type);
24992  Py_XDECREF(local_value);
24993  Py_XDECREF(local_tb);
24994  return -1;
24995 }
24996 
24997 /* RaiseException */
24998  #if PY_MAJOR_VERSION < 3
24999 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
25000  CYTHON_UNUSED PyObject *cause) {
25001  __Pyx_PyThreadState_declare
25002  Py_XINCREF(type);
25003  if (!value || value == Py_None)
25004  value = NULL;
25005  else
25006  Py_INCREF(value);
25007  if (!tb || tb == Py_None)
25008  tb = NULL;
25009  else {
25010  Py_INCREF(tb);
25011  if (!PyTraceBack_Check(tb)) {
25012  PyErr_SetString(PyExc_TypeError,
25013  "raise: arg 3 must be a traceback or None");
25014  goto raise_error;
25015  }
25016  }
25017  if (PyType_Check(type)) {
25018 #if CYTHON_COMPILING_IN_PYPY
25019  if (!value) {
25020  Py_INCREF(Py_None);
25021  value = Py_None;
25022  }
25023 #endif
25024  PyErr_NormalizeException(&type, &value, &tb);
25025  } else {
25026  if (value) {
25027  PyErr_SetString(PyExc_TypeError,
25028  "instance exception may not have a separate value");
25029  goto raise_error;
25030  }
25031  value = type;
25032  type = (PyObject*) Py_TYPE(type);
25033  Py_INCREF(type);
25034  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
25035  PyErr_SetString(PyExc_TypeError,
25036  "raise: exception class must be a subclass of BaseException");
25037  goto raise_error;
25038  }
25039  }
25040  __Pyx_PyThreadState_assign
25041  __Pyx_ErrRestore(type, value, tb);
25042  return;
25043 raise_error:
25044  Py_XDECREF(value);
25045  Py_XDECREF(type);
25046  Py_XDECREF(tb);
25047  return;
25048 }
25049 #else
25050 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
25051  PyObject* owned_instance = NULL;
25052  if (tb == Py_None) {
25053  tb = 0;
25054  } else if (tb && !PyTraceBack_Check(tb)) {
25055  PyErr_SetString(PyExc_TypeError,
25056  "raise: arg 3 must be a traceback or None");
25057  goto bad;
25058  }
25059  if (value == Py_None)
25060  value = 0;
25061  if (PyExceptionInstance_Check(type)) {
25062  if (value) {
25063  PyErr_SetString(PyExc_TypeError,
25064  "instance exception may not have a separate value");
25065  goto bad;
25066  }
25067  value = type;
25068  type = (PyObject*) Py_TYPE(value);
25069  } else if (PyExceptionClass_Check(type)) {
25070  PyObject *instance_class = NULL;
25071  if (value && PyExceptionInstance_Check(value)) {
25072  instance_class = (PyObject*) Py_TYPE(value);
25073  if (instance_class != type) {
25074  int is_subclass = PyObject_IsSubclass(instance_class, type);
25075  if (!is_subclass) {
25076  instance_class = NULL;
25077  } else if (unlikely(is_subclass == -1)) {
25078  goto bad;
25079  } else {
25080  type = instance_class;
25081  }
25082  }
25083  }
25084  if (!instance_class) {
25085  PyObject *args;
25086  if (!value)
25087  args = PyTuple_New(0);
25088  else if (PyTuple_Check(value)) {
25089  Py_INCREF(value);
25090  args = value;
25091  } else
25092  args = PyTuple_Pack(1, value);
25093  if (!args)
25094  goto bad;
25095  owned_instance = PyObject_Call(type, args, NULL);
25096  Py_DECREF(args);
25097  if (!owned_instance)
25098  goto bad;
25099  value = owned_instance;
25100  if (!PyExceptionInstance_Check(value)) {
25101  PyErr_Format(PyExc_TypeError,
25102  "calling %R should have returned an instance of "
25103  "BaseException, not %R",
25104  type, Py_TYPE(value));
25105  goto bad;
25106  }
25107  }
25108  } else {
25109  PyErr_SetString(PyExc_TypeError,
25110  "raise: exception class must be a subclass of BaseException");
25111  goto bad;
25112  }
25113  if (cause) {
25114  PyObject *fixed_cause;
25115  if (cause == Py_None) {
25116  fixed_cause = NULL;
25117  } else if (PyExceptionClass_Check(cause)) {
25118  fixed_cause = PyObject_CallObject(cause, NULL);
25119  if (fixed_cause == NULL)
25120  goto bad;
25121  } else if (PyExceptionInstance_Check(cause)) {
25122  fixed_cause = cause;
25123  Py_INCREF(fixed_cause);
25124  } else {
25125  PyErr_SetString(PyExc_TypeError,
25126  "exception causes must derive from "
25127  "BaseException");
25128  goto bad;
25129  }
25130  PyException_SetCause(value, fixed_cause);
25131  }
25132  PyErr_SetObject(type, value);
25133  if (tb) {
25134 #if CYTHON_COMPILING_IN_PYPY
25135  PyObject *tmp_type, *tmp_value, *tmp_tb;
25136  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
25137  Py_INCREF(tb);
25138  PyErr_Restore(tmp_type, tmp_value, tb);
25139  Py_XDECREF(tmp_tb);
25140 #else
25141  PyThreadState *tstate = __Pyx_PyThreadState_Current;
25142  PyObject* tmp_tb = tstate->curexc_traceback;
25143  if (tb != tmp_tb) {
25144  Py_INCREF(tb);
25145  tstate->curexc_traceback = tb;
25146  Py_XDECREF(tmp_tb);
25147  }
25148 #endif
25149  }
25150 bad:
25151  Py_XDECREF(owned_instance);
25152  return;
25153 }
25154 #endif
25155 
25156 /* TypeImport */
25157  #ifndef __PYX_HAVE_RT_ImportType
25158 #define __PYX_HAVE_RT_ImportType
25159 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
25160  size_t size, enum __Pyx_ImportType_CheckSize check_size)
25161 {
25162  PyObject *result = 0;
25163  char warning[200];
25164  Py_ssize_t basicsize;
25165 #ifdef Py_LIMITED_API
25166  PyObject *py_basicsize;
25167 #endif
25168  result = PyObject_GetAttrString(module, class_name);
25169  if (!result)
25170  goto bad;
25171  if (!PyType_Check(result)) {
25172  PyErr_Format(PyExc_TypeError,
25173  "%.200s.%.200s is not a type object",
25174  module_name, class_name);
25175  goto bad;
25176  }
25177 #ifndef Py_LIMITED_API
25178  basicsize = ((PyTypeObject *)result)->tp_basicsize;
25179 #else
25180  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
25181  if (!py_basicsize)
25182  goto bad;
25183  basicsize = PyLong_AsSsize_t(py_basicsize);
25184  Py_DECREF(py_basicsize);
25185  py_basicsize = 0;
25186  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25187  goto bad;
25188 #endif
25189  if ((size_t)basicsize < size) {
25190  PyErr_Format(PyExc_ValueError,
25191  "%.200s.%.200s size changed, may indicate binary incompatibility. "
25192  "Expected %zd from C header, got %zd from PyObject",
25193  module_name, class_name, size, basicsize);
25194  goto bad;
25195  }
25196  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
25197  PyErr_Format(PyExc_ValueError,
25198  "%.200s.%.200s size changed, may indicate binary incompatibility. "
25199  "Expected %zd from C header, got %zd from PyObject",
25200  module_name, class_name, size, basicsize);
25201  goto bad;
25202  }
25203  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
25204  PyOS_snprintf(warning, sizeof(warning),
25205  "%s.%s size changed, may indicate binary incompatibility. "
25206  "Expected %zd from C header, got %zd from PyObject",
25207  module_name, class_name, size, basicsize);
25208  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
25209  }
25210  return (PyTypeObject *)result;
25211 bad:
25212  Py_XDECREF(result);
25213  return NULL;
25214 }
25215 #endif
25216 
25217 /* Import */
25218  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
25219  PyObject *empty_list = 0;
25220  PyObject *module = 0;
25221  PyObject *global_dict = 0;
25222  PyObject *empty_dict = 0;
25223  PyObject *list;
25224  #if PY_MAJOR_VERSION < 3
25225  PyObject *py_import;
25226  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
25227  if (!py_import)
25228  goto bad;
25229  #endif
25230  if (from_list)
25231  list = from_list;
25232  else {
25233  empty_list = PyList_New(0);
25234  if (!empty_list)
25235  goto bad;
25236  list = empty_list;
25237  }
25238  global_dict = PyModule_GetDict(__pyx_m);
25239  if (!global_dict)
25240  goto bad;
25241  empty_dict = PyDict_New();
25242  if (!empty_dict)
25243  goto bad;
25244  {
25245  #if PY_MAJOR_VERSION >= 3
25246  if (level == -1) {
25247  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
25248  module = PyImport_ImportModuleLevelObject(
25249  name, global_dict, empty_dict, list, 1);
25250  if (!module) {
25251  if (!PyErr_ExceptionMatches(PyExc_ImportError))
25252  goto bad;
25253  PyErr_Clear();
25254  }
25255  }
25256  level = 0;
25257  }
25258  #endif
25259  if (!module) {
25260  #if PY_MAJOR_VERSION < 3
25261  PyObject *py_level = PyInt_FromLong(level);
25262  if (!py_level)
25263  goto bad;
25264  module = PyObject_CallFunctionObjArgs(py_import,
25265  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
25266  Py_DECREF(py_level);
25267  #else
25268  module = PyImport_ImportModuleLevelObject(
25269  name, global_dict, empty_dict, list, level);
25270  #endif
25271  }
25272  }
25273 bad:
25274  #if PY_MAJOR_VERSION < 3
25275  Py_XDECREF(py_import);
25276  #endif
25277  Py_XDECREF(empty_list);
25278  Py_XDECREF(empty_dict);
25279  return module;
25280 }
25281 
25282 /* CLineInTraceback */
25283  #ifndef CYTHON_CLINE_IN_TRACEBACK
25284 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
25285  PyObject *use_cline;
25286  PyObject *ptype, *pvalue, *ptraceback;
25287 #if CYTHON_COMPILING_IN_CPYTHON
25288  PyObject **cython_runtime_dict;
25289 #endif
25290  if (unlikely(!__pyx_cython_runtime)) {
25291  return c_line;
25292  }
25293  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25294 #if CYTHON_COMPILING_IN_CPYTHON
25295  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25296  if (likely(cython_runtime_dict)) {
25297  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25298  use_cline, *cython_runtime_dict,
25299  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25300  } else
25301 #endif
25302  {
25303  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25304  if (use_cline_obj) {
25305  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25306  Py_DECREF(use_cline_obj);
25307  } else {
25308  PyErr_Clear();
25309  use_cline = NULL;
25310  }
25311  }
25312  if (!use_cline) {
25313  c_line = 0;
25314  PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25315  }
25316  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25317  c_line = 0;
25318  }
25319  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25320  return c_line;
25321 }
25322 #endif
25323 
25324 /* CodeObjectCache */
25325  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
25326  int start = 0, mid = 0, end = count - 1;
25327  if (end >= 0 && code_line > entries[end].code_line) {
25328  return count;
25329  }
25330  while (start < end) {
25331  mid = start + (end - start) / 2;
25332  if (code_line < entries[mid].code_line) {
25333  end = mid;
25334  } else if (code_line > entries[mid].code_line) {
25335  start = mid + 1;
25336  } else {
25337  return mid;
25338  }
25339  }
25340  if (code_line <= entries[mid].code_line) {
25341  return mid;
25342  } else {
25343  return mid + 1;
25344  }
25345 }
25346 static PyCodeObject *__pyx_find_code_object(int code_line) {
25347  PyCodeObject* code_object;
25348  int pos;
25349  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25350  return NULL;
25351  }
25352  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25353  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25354  return NULL;
25355  }
25356  code_object = __pyx_code_cache.entries[pos].code_object;
25357  Py_INCREF(code_object);
25358  return code_object;
25359 }
25360 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
25361  int pos, i;
25362  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25363  if (unlikely(!code_line)) {
25364  return;
25365  }
25366  if (unlikely(!entries)) {
25367  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
25368  if (likely(entries)) {
25369  __pyx_code_cache.entries = entries;
25370  __pyx_code_cache.max_count = 64;
25371  __pyx_code_cache.count = 1;
25372  entries[0].code_line = code_line;
25373  entries[0].code_object = code_object;
25374  Py_INCREF(code_object);
25375  }
25376  return;
25377  }
25378  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25379  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25380  PyCodeObject* tmp = entries[pos].code_object;
25381  entries[pos].code_object = code_object;
25382  Py_DECREF(tmp);
25383  return;
25384  }
25385  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25386  int new_max = __pyx_code_cache.max_count + 64;
25387  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25388  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
25389  if (unlikely(!entries)) {
25390  return;
25391  }
25392  __pyx_code_cache.entries = entries;
25393  __pyx_code_cache.max_count = new_max;
25394  }
25395  for (i=__pyx_code_cache.count; i>pos; i--) {
25396  entries[i] = entries[i-1];
25397  }
25398  entries[pos].code_line = code_line;
25399  entries[pos].code_object = code_object;
25400  __pyx_code_cache.count++;
25401  Py_INCREF(code_object);
25402 }
25403 
25404 /* AddTraceback */
25405  #include "compile.h"
25406 #include "frameobject.h"
25407 #include "traceback.h"
25408 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25409  const char *funcname, int c_line,
25410  int py_line, const char *filename) {
25411  PyCodeObject *py_code = 0;
25412  PyObject *py_srcfile = 0;
25413  PyObject *py_funcname = 0;
25414  #if PY_MAJOR_VERSION < 3
25415  py_srcfile = PyString_FromString(filename);
25416  #else
25417  py_srcfile = PyUnicode_FromString(filename);
25418  #endif
25419  if (!py_srcfile) goto bad;
25420  if (c_line) {
25421  #if PY_MAJOR_VERSION < 3
25422  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25423  #else
25424  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25425  #endif
25426  }
25427  else {
25428  #if PY_MAJOR_VERSION < 3
25429  py_funcname = PyString_FromString(funcname);
25430  #else
25431  py_funcname = PyUnicode_FromString(funcname);
25432  #endif
25433  }
25434  if (!py_funcname) goto bad;
25435  py_code = __Pyx_PyCode_New(
25436  0,
25437  0,
25438  0,
25439  0,
25440  0,
25441  __pyx_empty_bytes, /*PyObject *code,*/
25442  __pyx_empty_tuple, /*PyObject *consts,*/
25443  __pyx_empty_tuple, /*PyObject *names,*/
25444  __pyx_empty_tuple, /*PyObject *varnames,*/
25445  __pyx_empty_tuple, /*PyObject *freevars,*/
25446  __pyx_empty_tuple, /*PyObject *cellvars,*/
25447  py_srcfile, /*PyObject *filename,*/
25448  py_funcname, /*PyObject *name,*/
25449  py_line,
25450  __pyx_empty_bytes /*PyObject *lnotab*/
25451  );
25452  Py_DECREF(py_srcfile);
25453  Py_DECREF(py_funcname);
25454  return py_code;
25455 bad:
25456  Py_XDECREF(py_srcfile);
25457  Py_XDECREF(py_funcname);
25458  return NULL;
25459 }
25460 static void __Pyx_AddTraceback(const char *funcname, int c_line,
25461  int py_line, const char *filename) {
25462  PyCodeObject *py_code = 0;
25463  PyFrameObject *py_frame = 0;
25464  PyThreadState *tstate = __Pyx_PyThreadState_Current;
25465  if (c_line) {
25466  c_line = __Pyx_CLineForTraceback(tstate, c_line);
25467  }
25468  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25469  if (!py_code) {
25470  py_code = __Pyx_CreateCodeObjectForTraceback(
25471  funcname, c_line, py_line, filename);
25472  if (!py_code) goto bad;
25473  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25474  }
25475  py_frame = PyFrame_New(
25476  tstate, /*PyThreadState *tstate,*/
25477  py_code, /*PyCodeObject *code,*/
25478  __pyx_d, /*PyObject *globals,*/
25479  0 /*PyObject *locals*/
25480  );
25481  if (!py_frame) goto bad;
25482  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25483  PyTraceBack_Here(py_frame);
25484 bad:
25485  Py_XDECREF(py_code);
25486  Py_XDECREF(py_frame);
25487 }
25488 
25489 #if PY_MAJOR_VERSION < 3
25490 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
25491  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
25492  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
25493  return -1;
25494 }
25495 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
25496  PyObject *obj = view->obj;
25497  if (!obj) return;
25498  if (PyObject_CheckBuffer(obj)) {
25499  PyBuffer_Release(view);
25500  return;
25501  }
25502  if ((0)) {}
25503  view->obj = NULL;
25504  Py_DECREF(obj);
25505 }
25506 #endif
25507 
25508 
25509  /* CIntFromPyVerify */
25510  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25511  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25512 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25513  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25514 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25515  {\
25516  func_type value = func_value;\
25517  if (sizeof(target_type) < sizeof(func_type)) {\
25518  if (unlikely(value != (func_type) (target_type) value)) {\
25519  func_type zero = 0;\
25520  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25521  return (target_type) -1;\
25522  if (is_unsigned && unlikely(value < zero))\
25523  goto raise_neg_overflow;\
25524  else\
25525  goto raise_overflow;\
25526  }\
25527  }\
25528  return (target_type) value;\
25529  }
25530 
25531 /* Declarations */
25532  #if CYTHON_CCOMPLEX
25533  #ifdef __cplusplus
25534  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25535  return ::std::complex< float >(x, y);
25536  }
25537  #else
25538  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25539  return x + y*(__pyx_t_float_complex)_Complex_I;
25540  }
25541  #endif
25542 #else
25543  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25544  __pyx_t_float_complex z;
25545  z.real = x;
25546  z.imag = y;
25547  return z;
25548  }
25549 #endif
25550 
25551 /* Arithmetic */
25552  #if CYTHON_CCOMPLEX
25553 #else
25554  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25555  return (a.real == b.real) && (a.imag == b.imag);
25556  }
25557  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25558  __pyx_t_float_complex z;
25559  z.real = a.real + b.real;
25560  z.imag = a.imag + b.imag;
25561  return z;
25562  }
25563  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25564  __pyx_t_float_complex z;
25565  z.real = a.real - b.real;
25566  z.imag = a.imag - b.imag;
25567  return z;
25568  }
25569  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25570  __pyx_t_float_complex z;
25571  z.real = a.real * b.real - a.imag * b.imag;
25572  z.imag = a.real * b.imag + a.imag * b.real;
25573  return z;
25574  }
25575  #if 1
25576  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25577  if (b.imag == 0) {
25578  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25579  } else if (fabsf(b.real) >= fabsf(b.imag)) {
25580  if (b.real == 0 && b.imag == 0) {
25581  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
25582  } else {
25583  float r = b.imag / b.real;
25584  float s = (float)(1.0) / (b.real + b.imag * r);
25585  return __pyx_t_float_complex_from_parts(
25586  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25587  }
25588  } else {
25589  float r = b.real / b.imag;
25590  float s = (float)(1.0) / (b.imag + b.real * r);
25591  return __pyx_t_float_complex_from_parts(
25592  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25593  }
25594  }
25595  #else
25596  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25597  if (b.imag == 0) {
25598  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25599  } else {
25600  float denom = b.real * b.real + b.imag * b.imag;
25601  return __pyx_t_float_complex_from_parts(
25602  (a.real * b.real + a.imag * b.imag) / denom,
25603  (a.imag * b.real - a.real * b.imag) / denom);
25604  }
25605  }
25606  #endif
25607  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
25608  __pyx_t_float_complex z;
25609  z.real = -a.real;
25610  z.imag = -a.imag;
25611  return z;
25612  }
25613  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
25614  return (a.real == 0) && (a.imag == 0);
25615  }
25616  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
25617  __pyx_t_float_complex z;
25618  z.real = a.real;
25619  z.imag = -a.imag;
25620  return z;
25621  }
25622  #if 1
25623  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
25624  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25625  return sqrtf(z.real*z.real + z.imag*z.imag);
25626  #else
25627  return hypotf(z.real, z.imag);
25628  #endif
25629  }
25630  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25631  __pyx_t_float_complex z;
25632  float r, lnr, theta, z_r, z_theta;
25633  if (b.imag == 0 && b.real == (int)b.real) {
25634  if (b.real < 0) {
25635  float denom = a.real * a.real + a.imag * a.imag;
25636  a.real = a.real / denom;
25637  a.imag = -a.imag / denom;
25638  b.real = -b.real;
25639  }
25640  switch ((int)b.real) {
25641  case 0:
25642  z.real = 1;
25643  z.imag = 0;
25644  return z;
25645  case 1:
25646  return a;
25647  case 2:
25648  return __Pyx_c_prod_float(a, a);
25649  case 3:
25650  z = __Pyx_c_prod_float(a, a);
25651  return __Pyx_c_prod_float(z, a);
25652  case 4:
25653  z = __Pyx_c_prod_float(a, a);
25654  return __Pyx_c_prod_float(z, z);
25655  }
25656  }
25657  if (a.imag == 0) {
25658  if (a.real == 0) {
25659  return a;
25660  } else if (b.imag == 0) {
25661  z.real = powf(a.real, b.real);
25662  z.imag = 0;
25663  return z;
25664  } else if (a.real > 0) {
25665  r = a.real;
25666  theta = 0;
25667  } else {
25668  r = -a.real;
25669  theta = atan2f(0.0, -1.0);
25670  }
25671  } else {
25672  r = __Pyx_c_abs_float(a);
25673  theta = atan2f(a.imag, a.real);
25674  }
25675  lnr = logf(r);
25676  z_r = expf(lnr * b.real - theta * b.imag);
25677  z_theta = theta * b.real + lnr * b.imag;
25678  z.real = z_r * cosf(z_theta);
25679  z.imag = z_r * sinf(z_theta);
25680  return z;
25681  }
25682  #endif
25683 #endif
25684 
25685 /* Declarations */
25686  #if CYTHON_CCOMPLEX
25687  #ifdef __cplusplus
25688  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25689  return ::std::complex< double >(x, y);
25690  }
25691  #else
25692  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25693  return x + y*(__pyx_t_double_complex)_Complex_I;
25694  }
25695  #endif
25696 #else
25697  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25698  __pyx_t_double_complex z;
25699  z.real = x;
25700  z.imag = y;
25701  return z;
25702  }
25703 #endif
25704 
25705 /* Arithmetic */
25706  #if CYTHON_CCOMPLEX
25707 #else
25708  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25709  return (a.real == b.real) && (a.imag == b.imag);
25710  }
25711  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25712  __pyx_t_double_complex z;
25713  z.real = a.real + b.real;
25714  z.imag = a.imag + b.imag;
25715  return z;
25716  }
25717  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25718  __pyx_t_double_complex z;
25719  z.real = a.real - b.real;
25720  z.imag = a.imag - b.imag;
25721  return z;
25722  }
25723  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25724  __pyx_t_double_complex z;
25725  z.real = a.real * b.real - a.imag * b.imag;
25726  z.imag = a.real * b.imag + a.imag * b.real;
25727  return z;
25728  }
25729  #if 1
25730  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25731  if (b.imag == 0) {
25732  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25733  } else if (fabs(b.real) >= fabs(b.imag)) {
25734  if (b.real == 0 && b.imag == 0) {
25735  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
25736  } else {
25737  double r = b.imag / b.real;
25738  double s = (double)(1.0) / (b.real + b.imag * r);
25739  return __pyx_t_double_complex_from_parts(
25740  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25741  }
25742  } else {
25743  double r = b.real / b.imag;
25744  double s = (double)(1.0) / (b.imag + b.real * r);
25745  return __pyx_t_double_complex_from_parts(
25746  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25747  }
25748  }
25749  #else
25750  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25751  if (b.imag == 0) {
25752  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25753  } else {
25754  double denom = b.real * b.real + b.imag * b.imag;
25755  return __pyx_t_double_complex_from_parts(
25756  (a.real * b.real + a.imag * b.imag) / denom,
25757  (a.imag * b.real - a.real * b.imag) / denom);
25758  }
25759  }
25760  #endif
25761  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
25762  __pyx_t_double_complex z;
25763  z.real = -a.real;
25764  z.imag = -a.imag;
25765  return z;
25766  }
25767  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
25768  return (a.real == 0) && (a.imag == 0);
25769  }
25770  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
25771  __pyx_t_double_complex z;
25772  z.real = a.real;
25773  z.imag = -a.imag;
25774  return z;
25775  }
25776  #if 1
25777  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
25778  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25779  return sqrt(z.real*z.real + z.imag*z.imag);
25780  #else
25781  return hypot(z.real, z.imag);
25782  #endif
25783  }
25784  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25785  __pyx_t_double_complex z;
25786  double r, lnr, theta, z_r, z_theta;
25787  if (b.imag == 0 && b.real == (int)b.real) {
25788  if (b.real < 0) {
25789  double denom = a.real * a.real + a.imag * a.imag;
25790  a.real = a.real / denom;
25791  a.imag = -a.imag / denom;
25792  b.real = -b.real;
25793  }
25794  switch ((int)b.real) {
25795  case 0:
25796  z.real = 1;
25797  z.imag = 0;
25798  return z;
25799  case 1:
25800  return a;
25801  case 2:
25802  return __Pyx_c_prod_double(a, a);
25803  case 3:
25804  z = __Pyx_c_prod_double(a, a);
25805  return __Pyx_c_prod_double(z, a);
25806  case 4:
25807  z = __Pyx_c_prod_double(a, a);
25808  return __Pyx_c_prod_double(z, z);
25809  }
25810  }
25811  if (a.imag == 0) {
25812  if (a.real == 0) {
25813  return a;
25814  } else if (b.imag == 0) {
25815  z.real = pow(a.real, b.real);
25816  z.imag = 0;
25817  return z;
25818  } else if (a.real > 0) {
25819  r = a.real;
25820  theta = 0;
25821  } else {
25822  r = -a.real;
25823  theta = atan2(0.0, -1.0);
25824  }
25825  } else {
25826  r = __Pyx_c_abs_double(a);
25827  theta = atan2(a.imag, a.real);
25828  }
25829  lnr = log(r);
25830  z_r = exp(lnr * b.real - theta * b.imag);
25831  z_theta = theta * b.real + lnr * b.imag;
25832  z.real = z_r * cos(z_theta);
25833  z.imag = z_r * sin(z_theta);
25834  return z;
25835  }
25836  #endif
25837 #endif
25838 
25839 /* CIntFromPy */
25840  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
25841 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25842 #pragma GCC diagnostic push
25843 #pragma GCC diagnostic ignored "-Wconversion"
25844 #endif
25845  const int neg_one = (int) -1, const_zero = (int) 0;
25846 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25847 #pragma GCC diagnostic pop
25848 #endif
25849  const int is_unsigned = neg_one > const_zero;
25850 #if PY_MAJOR_VERSION < 3
25851  if (likely(PyInt_Check(x))) {
25852  if (sizeof(int) < sizeof(long)) {
25853  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
25854  } else {
25855  long val = PyInt_AS_LONG(x);
25856  if (is_unsigned && unlikely(val < 0)) {
25857  goto raise_neg_overflow;
25858  }
25859  return (int) val;
25860  }
25861  } else
25862 #endif
25863  if (likely(PyLong_Check(x))) {
25864  if (is_unsigned) {
25865 #if CYTHON_USE_PYLONG_INTERNALS
25866  const digit* digits = ((PyLongObject*)x)->ob_digit;
25867  switch (Py_SIZE(x)) {
25868  case 0: return (int) 0;
25869  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
25870  case 2:
25871  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25872  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25873  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25874  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
25875  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25876  }
25877  }
25878  break;
25879  case 3:
25880  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25881  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25882  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25883  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
25884  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25885  }
25886  }
25887  break;
25888  case 4:
25889  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25890  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25891  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25892  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
25893  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25894  }
25895  }
25896  break;
25897  }
25898 #endif
25899 #if CYTHON_COMPILING_IN_CPYTHON
25900  if (unlikely(Py_SIZE(x) < 0)) {
25901  goto raise_neg_overflow;
25902  }
25903 #else
25904  {
25905  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25906  if (unlikely(result < 0))
25907  return (int) -1;
25908  if (unlikely(result == 1))
25909  goto raise_neg_overflow;
25910  }
25911 #endif
25912  if (sizeof(int) <= sizeof(unsigned long)) {
25913  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
25914 #ifdef HAVE_LONG_LONG
25915  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
25916  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25917 #endif
25918  }
25919  } else {
25920 #if CYTHON_USE_PYLONG_INTERNALS
25921  const digit* digits = ((PyLongObject*)x)->ob_digit;
25922  switch (Py_SIZE(x)) {
25923  case 0: return (int) 0;
25924  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
25925  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
25926  case -2:
25927  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
25928  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25929  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25930  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25931  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25932  }
25933  }
25934  break;
25935  case 2:
25936  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25937  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25938  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25939  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25940  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25941  }
25942  }
25943  break;
25944  case -3:
25945  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25946  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25947  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25948  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25949  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25950  }
25951  }
25952  break;
25953  case 3:
25954  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25955  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25956  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25957  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25958  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25959  }
25960  }
25961  break;
25962  case -4:
25963  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25964  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25965  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25966  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25967  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25968  }
25969  }
25970  break;
25971  case 4:
25972  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25973  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25974  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25975  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25976  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25977  }
25978  }
25979  break;
25980  }
25981 #endif
25982  if (sizeof(int) <= sizeof(long)) {
25983  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
25984 #ifdef HAVE_LONG_LONG
25985  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
25986  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
25987 #endif
25988  }
25989  }
25990  {
25991 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25992  PyErr_SetString(PyExc_RuntimeError,
25993  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25994 #else
25995  int val;
25996  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25997  #if PY_MAJOR_VERSION < 3
25998  if (likely(v) && !PyLong_Check(v)) {
25999  PyObject *tmp = v;
26000  v = PyNumber_Long(tmp);
26001  Py_DECREF(tmp);
26002  }
26003  #endif
26004  if (likely(v)) {
26005  int one = 1; int is_little = (int)*(unsigned char *)&one;
26006  unsigned char *bytes = (unsigned char *)&val;
26007  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26008  bytes, sizeof(val),
26009  is_little, !is_unsigned);
26010  Py_DECREF(v);
26011  if (likely(!ret))
26012  return val;
26013  }
26014 #endif
26015  return (int) -1;
26016  }
26017  } else {
26018  int val;
26019  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26020  if (!tmp) return (int) -1;
26021  val = __Pyx_PyInt_As_int(tmp);
26022  Py_DECREF(tmp);
26023  return val;
26024  }
26025 raise_overflow:
26026  PyErr_SetString(PyExc_OverflowError,
26027  "value too large to convert to int");
26028  return (int) -1;
26029 raise_neg_overflow:
26030  PyErr_SetString(PyExc_OverflowError,
26031  "can't convert negative value to int");
26032  return (int) -1;
26033 }
26034 
26035 /* CIntToPy */
26036  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26037 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26038 #pragma GCC diagnostic push
26039 #pragma GCC diagnostic ignored "-Wconversion"
26040 #endif
26041  const int neg_one = (int) -1, const_zero = (int) 0;
26042 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26043 #pragma GCC diagnostic pop
26044 #endif
26045  const int is_unsigned = neg_one > const_zero;
26046  if (is_unsigned) {
26047  if (sizeof(int) < sizeof(long)) {
26048  return PyInt_FromLong((long) value);
26049  } else if (sizeof(int) <= sizeof(unsigned long)) {
26050  return PyLong_FromUnsignedLong((unsigned long) value);
26051 #ifdef HAVE_LONG_LONG
26052  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26053  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26054 #endif
26055  }
26056  } else {
26057  if (sizeof(int) <= sizeof(long)) {
26058  return PyInt_FromLong((long) value);
26059 #ifdef HAVE_LONG_LONG
26060  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26061  return PyLong_FromLongLong((PY_LONG_LONG) value);
26062 #endif
26063  }
26064  }
26065  {
26066  int one = 1; int little = (int)*(unsigned char *)&one;
26067  unsigned char *bytes = (unsigned char *)&value;
26068  return _PyLong_FromByteArray(bytes, sizeof(int),
26069  little, !is_unsigned);
26070  }
26071 }
26072 
26073 /* CIntToPy */
26074  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
26075 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26076 #pragma GCC diagnostic push
26077 #pragma GCC diagnostic ignored "-Wconversion"
26078 #endif
26079  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26080 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26081 #pragma GCC diagnostic pop
26082 #endif
26083  const int is_unsigned = neg_one > const_zero;
26084  if (is_unsigned) {
26085  if (sizeof(Py_intptr_t) < sizeof(long)) {
26086  return PyInt_FromLong((long) value);
26087  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26088  return PyLong_FromUnsignedLong((unsigned long) value);
26089 #ifdef HAVE_LONG_LONG
26090  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26091  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26092 #endif
26093  }
26094  } else {
26095  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26096  return PyInt_FromLong((long) value);
26097 #ifdef HAVE_LONG_LONG
26098  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26099  return PyLong_FromLongLong((PY_LONG_LONG) value);
26100 #endif
26101  }
26102  }
26103  {
26104  int one = 1; int little = (int)*(unsigned char *)&one;
26105  unsigned char *bytes = (unsigned char *)&value;
26106  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
26107  little, !is_unsigned);
26108  }
26109 }
26110 
26111 /* CIntFromPy */
26112  static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
26113 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26114 #pragma GCC diagnostic push
26115 #pragma GCC diagnostic ignored "-Wconversion"
26116 #endif
26117  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26118 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26119 #pragma GCC diagnostic pop
26120 #endif
26121  const int is_unsigned = neg_one > const_zero;
26122 #if PY_MAJOR_VERSION < 3
26123  if (likely(PyInt_Check(x))) {
26124  if (sizeof(Py_intptr_t) < sizeof(long)) {
26125  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
26126  } else {
26127  long val = PyInt_AS_LONG(x);
26128  if (is_unsigned && unlikely(val < 0)) {
26129  goto raise_neg_overflow;
26130  }
26131  return (Py_intptr_t) val;
26132  }
26133  } else
26134 #endif
26135  if (likely(PyLong_Check(x))) {
26136  if (is_unsigned) {
26137 #if CYTHON_USE_PYLONG_INTERNALS
26138  const digit* digits = ((PyLongObject*)x)->ob_digit;
26139  switch (Py_SIZE(x)) {
26140  case 0: return (Py_intptr_t) 0;
26141  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
26142  case 2:
26143  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26144  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26145  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26146  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
26147  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26148  }
26149  }
26150  break;
26151  case 3:
26152  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26153  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26154  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26155  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
26156  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26157  }
26158  }
26159  break;
26160  case 4:
26161  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26162  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26163  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26164  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
26165  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26166  }
26167  }
26168  break;
26169  }
26170 #endif
26171 #if CYTHON_COMPILING_IN_CPYTHON
26172  if (unlikely(Py_SIZE(x) < 0)) {
26173  goto raise_neg_overflow;
26174  }
26175 #else
26176  {
26177  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26178  if (unlikely(result < 0))
26179  return (Py_intptr_t) -1;
26180  if (unlikely(result == 1))
26181  goto raise_neg_overflow;
26182  }
26183 #endif
26184  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26185  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
26186 #ifdef HAVE_LONG_LONG
26187  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26188  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26189 #endif
26190  }
26191  } else {
26192 #if CYTHON_USE_PYLONG_INTERNALS
26193  const digit* digits = ((PyLongObject*)x)->ob_digit;
26194  switch (Py_SIZE(x)) {
26195  case 0: return (Py_intptr_t) 0;
26196  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
26197  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
26198  case -2:
26199  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
26200  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26201  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26202  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26203  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26204  }
26205  }
26206  break;
26207  case 2:
26208  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26209  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26210  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26211  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26212  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26213  }
26214  }
26215  break;
26216  case -3:
26217  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26218  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26219  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26220  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26221  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26222  }
26223  }
26224  break;
26225  case 3:
26226  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26227  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26228  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26229  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26230  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26231  }
26232  }
26233  break;
26234  case -4:
26235  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26236  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26237  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26238  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26239  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26240  }
26241  }
26242  break;
26243  case 4:
26244  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26245  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26246  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26247  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26248  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26249  }
26250  }
26251  break;
26252  }
26253 #endif
26254  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26255  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
26256 #ifdef HAVE_LONG_LONG
26257  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26258  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
26259 #endif
26260  }
26261  }
26262  {
26263 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26264  PyErr_SetString(PyExc_RuntimeError,
26265  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26266 #else
26267  Py_intptr_t val;
26268  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26269  #if PY_MAJOR_VERSION < 3
26270  if (likely(v) && !PyLong_Check(v)) {
26271  PyObject *tmp = v;
26272  v = PyNumber_Long(tmp);
26273  Py_DECREF(tmp);
26274  }
26275  #endif
26276  if (likely(v)) {
26277  int one = 1; int is_little = (int)*(unsigned char *)&one;
26278  unsigned char *bytes = (unsigned char *)&val;
26279  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26280  bytes, sizeof(val),
26281  is_little, !is_unsigned);
26282  Py_DECREF(v);
26283  if (likely(!ret))
26284  return val;
26285  }
26286 #endif
26287  return (Py_intptr_t) -1;
26288  }
26289  } else {
26290  Py_intptr_t val;
26291  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26292  if (!tmp) return (Py_intptr_t) -1;
26293  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
26294  Py_DECREF(tmp);
26295  return val;
26296  }
26297 raise_overflow:
26298  PyErr_SetString(PyExc_OverflowError,
26299  "value too large to convert to Py_intptr_t");
26300  return (Py_intptr_t) -1;
26301 raise_neg_overflow:
26302  PyErr_SetString(PyExc_OverflowError,
26303  "can't convert negative value to Py_intptr_t");
26304  return (Py_intptr_t) -1;
26305 }
26306 
26307 /* CIntToPy */
26308  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26309 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26310 #pragma GCC diagnostic push
26311 #pragma GCC diagnostic ignored "-Wconversion"
26312 #endif
26313  const long neg_one = (long) -1, const_zero = (long) 0;
26314 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26315 #pragma GCC diagnostic pop
26316 #endif
26317  const int is_unsigned = neg_one > const_zero;
26318  if (is_unsigned) {
26319  if (sizeof(long) < sizeof(long)) {
26320  return PyInt_FromLong((long) value);
26321  } else if (sizeof(long) <= sizeof(unsigned long)) {
26322  return PyLong_FromUnsignedLong((unsigned long) value);
26323 #ifdef HAVE_LONG_LONG
26324  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26325  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26326 #endif
26327  }
26328  } else {
26329  if (sizeof(long) <= sizeof(long)) {
26330  return PyInt_FromLong((long) value);
26331 #ifdef HAVE_LONG_LONG
26332  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26333  return PyLong_FromLongLong((PY_LONG_LONG) value);
26334 #endif
26335  }
26336  }
26337  {
26338  int one = 1; int little = (int)*(unsigned char *)&one;
26339  unsigned char *bytes = (unsigned char *)&value;
26340  return _PyLong_FromByteArray(bytes, sizeof(long),
26341  little, !is_unsigned);
26342  }
26343 }
26344 
26345 /* CIntFromPy */
26346  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
26347 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26348 #pragma GCC diagnostic push
26349 #pragma GCC diagnostic ignored "-Wconversion"
26350 #endif
26351  const long neg_one = (long) -1, const_zero = (long) 0;
26352 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26353 #pragma GCC diagnostic pop
26354 #endif
26355  const int is_unsigned = neg_one > const_zero;
26356 #if PY_MAJOR_VERSION < 3
26357  if (likely(PyInt_Check(x))) {
26358  if (sizeof(long) < sizeof(long)) {
26359  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
26360  } else {
26361  long val = PyInt_AS_LONG(x);
26362  if (is_unsigned && unlikely(val < 0)) {
26363  goto raise_neg_overflow;
26364  }
26365  return (long) val;
26366  }
26367  } else
26368 #endif
26369  if (likely(PyLong_Check(x))) {
26370  if (is_unsigned) {
26371 #if CYTHON_USE_PYLONG_INTERNALS
26372  const digit* digits = ((PyLongObject*)x)->ob_digit;
26373  switch (Py_SIZE(x)) {
26374  case 0: return (long) 0;
26375  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
26376  case 2:
26377  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26378  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26379  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26380  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
26381  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26382  }
26383  }
26384  break;
26385  case 3:
26386  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26387  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26388  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26389  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
26390  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26391  }
26392  }
26393  break;
26394  case 4:
26395  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26396  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26397  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26398  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
26399  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26400  }
26401  }
26402  break;
26403  }
26404 #endif
26405 #if CYTHON_COMPILING_IN_CPYTHON
26406  if (unlikely(Py_SIZE(x) < 0)) {
26407  goto raise_neg_overflow;
26408  }
26409 #else
26410  {
26411  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26412  if (unlikely(result < 0))
26413  return (long) -1;
26414  if (unlikely(result == 1))
26415  goto raise_neg_overflow;
26416  }
26417 #endif
26418  if (sizeof(long) <= sizeof(unsigned long)) {
26419  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
26420 #ifdef HAVE_LONG_LONG
26421  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26422  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26423 #endif
26424  }
26425  } else {
26426 #if CYTHON_USE_PYLONG_INTERNALS
26427  const digit* digits = ((PyLongObject*)x)->ob_digit;
26428  switch (Py_SIZE(x)) {
26429  case 0: return (long) 0;
26430  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
26431  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
26432  case -2:
26433  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
26434  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26435  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26436  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26437  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26438  }
26439  }
26440  break;
26441  case 2:
26442  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26443  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26444  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26445  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26446  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26447  }
26448  }
26449  break;
26450  case -3:
26451  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26452  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26453  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26454  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26455  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26456  }
26457  }
26458  break;
26459  case 3:
26460  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26461  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26462  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26463  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26464  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26465  }
26466  }
26467  break;
26468  case -4:
26469  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26470  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26471  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26472  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26473  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26474  }
26475  }
26476  break;
26477  case 4:
26478  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26479  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26480  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26481  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26482  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26483  }
26484  }
26485  break;
26486  }
26487 #endif
26488  if (sizeof(long) <= sizeof(long)) {
26489  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
26490 #ifdef HAVE_LONG_LONG
26491  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26492  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
26493 #endif
26494  }
26495  }
26496  {
26497 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26498  PyErr_SetString(PyExc_RuntimeError,
26499  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26500 #else
26501  long val;
26502  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26503  #if PY_MAJOR_VERSION < 3
26504  if (likely(v) && !PyLong_Check(v)) {
26505  PyObject *tmp = v;
26506  v = PyNumber_Long(tmp);
26507  Py_DECREF(tmp);
26508  }
26509  #endif
26510  if (likely(v)) {
26511  int one = 1; int is_little = (int)*(unsigned char *)&one;
26512  unsigned char *bytes = (unsigned char *)&val;
26513  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26514  bytes, sizeof(val),
26515  is_little, !is_unsigned);
26516  Py_DECREF(v);
26517  if (likely(!ret))
26518  return val;
26519  }
26520 #endif
26521  return (long) -1;
26522  }
26523  } else {
26524  long val;
26525  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26526  if (!tmp) return (long) -1;
26527  val = __Pyx_PyInt_As_long(tmp);
26528  Py_DECREF(tmp);
26529  return val;
26530  }
26531 raise_overflow:
26532  PyErr_SetString(PyExc_OverflowError,
26533  "value too large to convert to long");
26534  return (long) -1;
26535 raise_neg_overflow:
26536  PyErr_SetString(PyExc_OverflowError,
26537  "can't convert negative value to long");
26538  return (long) -1;
26539 }
26540 
26541 /* FastTypeChecks */
26542  #if CYTHON_COMPILING_IN_CPYTHON
26543 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
26544  while (a) {
26545  a = a->tp_base;
26546  if (a == b)
26547  return 1;
26548  }
26549  return b == &PyBaseObject_Type;
26550 }
26551 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
26552  PyObject *mro;
26553  if (a == b) return 1;
26554  mro = a->tp_mro;
26555  if (likely(mro)) {
26556  Py_ssize_t i, n;
26557  n = PyTuple_GET_SIZE(mro);
26558  for (i = 0; i < n; i++) {
26559  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
26560  return 1;
26561  }
26562  return 0;
26563  }
26564  return __Pyx_InBases(a, b);
26565 }
26566 #if PY_MAJOR_VERSION == 2
26567 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
26568  PyObject *exception, *value, *tb;
26569  int res;
26570  __Pyx_PyThreadState_declare
26571  __Pyx_PyThreadState_assign
26572  __Pyx_ErrFetch(&exception, &value, &tb);
26573  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
26574  if (unlikely(res == -1)) {
26575  PyErr_WriteUnraisable(err);
26576  res = 0;
26577  }
26578  if (!res) {
26579  res = PyObject_IsSubclass(err, exc_type2);
26580  if (unlikely(res == -1)) {
26581  PyErr_WriteUnraisable(err);
26582  res = 0;
26583  }
26584  }
26585  __Pyx_ErrRestore(exception, value, tb);
26586  return res;
26587 }
26588 #else
26589 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
26590  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
26591  if (!res) {
26592  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
26593  }
26594  return res;
26595 }
26596 #endif
26597 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
26598  Py_ssize_t i, n;
26599  assert(PyExceptionClass_Check(exc_type));
26600  n = PyTuple_GET_SIZE(tuple);
26601 #if PY_MAJOR_VERSION >= 3
26602  for (i=0; i<n; i++) {
26603  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
26604  }
26605 #endif
26606  for (i=0; i<n; i++) {
26607  PyObject *t = PyTuple_GET_ITEM(tuple, i);
26608  #if PY_MAJOR_VERSION < 3
26609  if (likely(exc_type == t)) return 1;
26610  #endif
26611  if (likely(PyExceptionClass_Check(t))) {
26612  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
26613  } else {
26614  }
26615  }
26616  return 0;
26617 }
26618 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
26619  if (likely(err == exc_type)) return 1;
26620  if (likely(PyExceptionClass_Check(err))) {
26621  if (likely(PyExceptionClass_Check(exc_type))) {
26622  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
26623  } else if (likely(PyTuple_Check(exc_type))) {
26624  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
26625  } else {
26626  }
26627  }
26628  return PyErr_GivenExceptionMatches(err, exc_type);
26629 }
26630 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
26631  assert(PyExceptionClass_Check(exc_type1));
26632  assert(PyExceptionClass_Check(exc_type2));
26633  if (likely(err == exc_type1 || err == exc_type2)) return 1;
26634  if (likely(PyExceptionClass_Check(err))) {
26635  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
26636  }
26637  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
26638 }
26639 #endif
26640 
26641 /* CheckBinaryVersion */
26642  static int __Pyx_check_binary_version(void) {
26643  char ctversion[4], rtversion[4];
26644  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
26645  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
26646  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
26647  char message[200];
26648  PyOS_snprintf(message, sizeof(message),
26649  "compiletime version %s of module '%.100s' "
26650  "does not match runtime version %s",
26651  ctversion, __Pyx_MODULE_NAME, rtversion);
26652  return PyErr_WarnEx(NULL, message, 1);
26653  }
26654  return 0;
26655 }
26656 
26657 /* InitStrings */
26658  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
26659  while (t->p) {
26660  #if PY_MAJOR_VERSION < 3
26661  if (t->is_unicode) {
26662  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
26663  } else if (t->intern) {
26664  *t->p = PyString_InternFromString(t->s);
26665  } else {
26666  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
26667  }
26668  #else
26669  if (t->is_unicode | t->is_str) {
26670  if (t->intern) {
26671  *t->p = PyUnicode_InternFromString(t->s);
26672  } else if (t->encoding) {
26673  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
26674  } else {
26675  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
26676  }
26677  } else {
26678  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
26679  }
26680  #endif
26681  if (!*t->p)
26682  return -1;
26683  if (PyObject_Hash(*t->p) == -1)
26684  return -1;
26685  ++t;
26686  }
26687  return 0;
26688 }
26689 
26690 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
26691  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
26692 }
26693 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
26694  Py_ssize_t ignore;
26695  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
26696 }
26697 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26698 #if !CYTHON_PEP393_ENABLED
26699 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26700  char* defenc_c;
26701  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
26702  if (!defenc) return NULL;
26703  defenc_c = PyBytes_AS_STRING(defenc);
26704 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26705  {
26706  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
26707  char* c;
26708  for (c = defenc_c; c < end; c++) {
26709  if ((unsigned char) (*c) >= 128) {
26710  PyUnicode_AsASCIIString(o);
26711  return NULL;
26712  }
26713  }
26714  }
26715 #endif
26716  *length = PyBytes_GET_SIZE(defenc);
26717  return defenc_c;
26718 }
26719 #else
26720 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26721  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
26722 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26723  if (likely(PyUnicode_IS_ASCII(o))) {
26724  *length = PyUnicode_GET_LENGTH(o);
26725  return PyUnicode_AsUTF8(o);
26726  } else {
26727  PyUnicode_AsASCIIString(o);
26728  return NULL;
26729  }
26730 #else
26731  return PyUnicode_AsUTF8AndSize(o, length);
26732 #endif
26733 }
26734 #endif
26735 #endif
26736 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26737 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26738  if (
26739 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26740  __Pyx_sys_getdefaultencoding_not_ascii &&
26741 #endif
26742  PyUnicode_Check(o)) {
26743  return __Pyx_PyUnicode_AsStringAndSize(o, length);
26744  } else
26745 #endif
26746 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
26747  if (PyByteArray_Check(o)) {
26748  *length = PyByteArray_GET_SIZE(o);
26749  return PyByteArray_AS_STRING(o);
26750  } else
26751 #endif
26752  {
26753  char* result;
26754  int r = PyBytes_AsStringAndSize(o, &result, length);
26755  if (unlikely(r < 0)) {
26756  return NULL;
26757  } else {
26758  return result;
26759  }
26760  }
26761 }
26762 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
26763  int is_true = x == Py_True;
26764  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
26765  else return PyObject_IsTrue(x);
26766 }
26767 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
26768  int retval;
26769  if (unlikely(!x)) return -1;
26770  retval = __Pyx_PyObject_IsTrue(x);
26771  Py_DECREF(x);
26772  return retval;
26773 }
26774 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
26775 #if PY_MAJOR_VERSION >= 3
26776  if (PyLong_Check(result)) {
26777  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
26778  "__int__ returned non-int (type %.200s). "
26779  "The ability to return an instance of a strict subclass of int "
26780  "is deprecated, and may be removed in a future version of Python.",
26781  Py_TYPE(result)->tp_name)) {
26782  Py_DECREF(result);
26783  return NULL;
26784  }
26785  return result;
26786  }
26787 #endif
26788  PyErr_Format(PyExc_TypeError,
26789  "__%.4s__ returned non-%.4s (type %.200s)",
26790  type_name, type_name, Py_TYPE(result)->tp_name);
26791  Py_DECREF(result);
26792  return NULL;
26793 }
26794 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26795 #if CYTHON_USE_TYPE_SLOTS
26796  PyNumberMethods *m;
26797 #endif
26798  const char *name = NULL;
26799  PyObject *res = NULL;
26800 #if PY_MAJOR_VERSION < 3
26801  if (likely(PyInt_Check(x) || PyLong_Check(x)))
26802 #else
26803  if (likely(PyLong_Check(x)))
26804 #endif
26805  return __Pyx_NewRef(x);
26806 #if CYTHON_USE_TYPE_SLOTS
26807  m = Py_TYPE(x)->tp_as_number;
26808  #if PY_MAJOR_VERSION < 3
26809  if (m && m->nb_int) {
26810  name = "int";
26811  res = m->nb_int(x);
26812  }
26813  else if (m && m->nb_long) {
26814  name = "long";
26815  res = m->nb_long(x);
26816  }
26817  #else
26818  if (likely(m && m->nb_int)) {
26819  name = "int";
26820  res = m->nb_int(x);
26821  }
26822  #endif
26823 #else
26824  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26825  res = PyNumber_Int(x);
26826  }
26827 #endif
26828  if (likely(res)) {
26829 #if PY_MAJOR_VERSION < 3
26830  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26831 #else
26832  if (unlikely(!PyLong_CheckExact(res))) {
26833 #endif
26834  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26835  }
26836  }
26837  else if (!PyErr_Occurred()) {
26838  PyErr_SetString(PyExc_TypeError,
26839  "an integer is required");
26840  }
26841  return res;
26842 }
26843 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26844  Py_ssize_t ival;
26845  PyObject *x;
26846 #if PY_MAJOR_VERSION < 3
26847  if (likely(PyInt_CheckExact(b))) {
26848  if (sizeof(Py_ssize_t) >= sizeof(long))
26849  return PyInt_AS_LONG(b);
26850  else
26851  return PyInt_AsSsize_t(b);
26852  }
26853 #endif
26854  if (likely(PyLong_CheckExact(b))) {
26855  #if CYTHON_USE_PYLONG_INTERNALS
26856  const digit* digits = ((PyLongObject*)b)->ob_digit;
26857  const Py_ssize_t size = Py_SIZE(b);
26858  if (likely(__Pyx_sst_abs(size) <= 1)) {
26859  ival = likely(size) ? digits[0] : 0;
26860  if (size == -1) ival = -ival;
26861  return ival;
26862  } else {
26863  switch (size) {
26864  case 2:
26865  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26866  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26867  }
26868  break;
26869  case -2:
26870  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26871  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26872  }
26873  break;
26874  case 3:
26875  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26876  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26877  }
26878  break;
26879  case -3:
26880  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26881  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26882  }
26883  break;
26884  case 4:
26885  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26886  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26887  }
26888  break;
26889  case -4:
26890  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26891  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26892  }
26893  break;
26894  }
26895  }
26896  #endif
26897  return PyLong_AsSsize_t(b);
26898  }
26899  x = PyNumber_Index(b);
26900  if (!x) return -1;
26901  ival = PyInt_AsSsize_t(x);
26902  Py_DECREF(x);
26903  return ival;
26904 }
26905 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
26906  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
26907 }
26908 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
26909  return PyInt_FromSize_t(ival);
26910 }
26911 
26912 
26913 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
number
Int number
Definition: Headers.h:33
s
Double s
Definition: Headers.h:84
n
Int n
Definition: Headers.h:28
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8